Setting max upload size

Setting max upload size

by Eric Kemsley -
Number of replies: 6

Ver 1.6- I have set the max uploald size to 2 MB, but I still can not upload a file that is 1.5 MB.

"This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP settings post_max_size and upload_max_filesize, as well as the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level."

Where are those PHP settings and in apache?

Thanks,

Eric

Average of ratings: -
In reply to Eric Kemsley

Re: Setting max upload size

by Rick Boyce -
The php settings are in the php.ini file - where this is depends on your installation. I think the default place on windows is C:/windows/php.ini on Linux it depends on your install method, it will probably be somewhere like /etc/php/php.ini or some variation, for example on my Ubuntu machine it is located in /etc/php5/apache2/php.ini

When you find the file do a text search for the strings post_max_size and upload_max_filesize. It should have either a number after it (the filesize in bytes) or something like 2M (2 megabytes).

The apache directive will be in Apache's main config file, for example /etc/apache2/httpd.conf or /etc/apache2/httpd.com. Again do a text search for
LimitRequestBody and set it to match what you just put in the php.ini file.

You'll need to restart the apache webserver for these changes to take effect, on a linux box you can probably use the following: /etc/init.d/apache2 restart - I think Apache on windows has some bat files in the apache install directory which do the same.

Best of luck finding those directives!
In reply to Eric Kemsley

Re: Setting max upload size

by Rick Boyce -
Forgot to mention above that if you run phpinfo() (create a new php file which contains the following <?php phpinfo(); ?> and place it on your webserver, then view it from your browser) you can see the php.ini file location and where the apache server is located.

The php.ini file is given by the 'Configuration File (php.ini) Path' line and the apache directory is shown next to 'Server Root' (the apache confif file will be in this directory.

You can also view the curent settings for post_max_size and upload_max_filesize on that page that phpinfo(); produces smile
In reply to Rick Boyce

Re: Setting max upload size

by Eric Kemsley -
I found the setting in the php.ini and it is set to 8M. I can not find the LimitRequestBody in the httpd.conf. Is it supposed to be there?
In reply to Eric Kemsley

Re: Setting max upload size

by Rick Boyce -
If you have an apache.conf or an apache2.conf file (some distros use this as the config file) then it might be in there.

Otherwise it probably isn't there, the best thing to do is to add it in. If there's a problem then you'll get an error message when you try to restart apache, otherwise you should be good to go.

If the config for your site is within a virtual host block (<VirtualHost *> for example) then you can add something like LimitRequestBody 8388608 just inside that tag.

If you config isn't within a virtual host then just add it to the end of your httpd.conf / apache2.conf file and reload apache. Hopefully that will give you your 8Meg upload smile
In reply to Eric Kemsley

Re: Setting max upload size

by Nuno Costa -

I have the same problem as you. However, I believe it also depends on your web connection. When I am at school I cannot upload any file above 1M. However, at work, where my connection is 4 times faster, all files up to 2M are uploaded easily.