On Wed, Dec 24, 2008 at 3:03 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: > On Wed, 2008-12-24 at 11:23 -0500, Xn Nooby wrote: >> I am using PHP5 on Ubuntu 8.10 Server, it is being used by Apache and >> Squirrelmail. I have tried setting the upload_max_filesize in the >> /etc/php5/apache2/php.ini file, but it only seems to apply after I >> upload the file. My goal is to prevent remote Squirrelmail users from >> attaching large files to the emails they are drafting. They have slow >> connections, and uploading a large file would effectively hang them. >> >> >> Here is my question originally posted to the Ubuntu Forum (before I >> began understand it was possibly a PHP issue): >> >> >> Is it possible to prevent Squirrelmail users from uploading large >> files to a server running Squirrelmail? My testing seems to indicate >> that the attachment size limits enforced by Squirrelmail take place >> *after* the file has been uploaded - at which time Squirrelmail aborts >> the entire message. I will have some remote users, and I do not want >> them to be able to upload files that are over a limit (say 10MB). >> >> If a remote user tries to attach a 500MB attachment to their email, I >> don't want them to upload the entire 500MB file, only to then have SM >> abort the message. I want it to fail immediately, or after the 10MB >> limit has been reached. >> >> I though there was a way to do this in Apache or PHP, but have been >> unable to find it. I am running Ubuntu Server 8.10 with Apache, >> Postfix, Dovecot, and Squirrelmail. >> >> Any suggestions on how to get the file attaching process to abort >> before it uploads the entire 500MB file? >> >> thanks! >> > You could look at amending the form that is shown on the client machines > browser, and set a size there, although the browser may only use it as a > suggestion rather than enforce it. Maybe Squirrelmail already has such a > feature? > > > Ash > www.ashleysheridan.co.uk > > I was able to solve this by adding the value "LimitRequestBody" to an Apache/PHP config file. Now it immediately aborts the upload after the limit has been set. I set the limit to about 11MB with these commands: sudo vi /etc/apache2/mods-enabled/php5.conf LimitRequestBody 11222333 thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php