Page 1 of 1

Setting post_max_size at runtime

Posted: Sat Jun 28, 2008 10:38 am
by jamesm6162
Hi

Suppose for a moment that you do NOT have access to the php.ini file....

Okay, now, I have a form to upload images and it does contain the MAX_FILE_SIZE hidden input field, and it does appear before the file upload input field.

It sets the max upload size to roughly 3MB

The current value of the php directive post_max_size is only 2M.
If I try to upload a file of about 6MB, it gives me the error:
Quote:
POST Content-Length of 7007829 bytes exceeds the limit of 2097152 bytes in Unknown on line 0

this I assumed is because of this max post value being to small (more specifically, smaller than the upload_max_filesize).

How do I change this post value at runtime to avoid this?

Re: Setting post_max_size at runtime

Posted: Sat Jun 28, 2008 10:43 am
by onion2k
You can't change that in a script... change it in the php.ini file.

Changing it in .htaccess might work too..

Re: Setting post_max_size at runtime

Posted: Sat Jun 28, 2008 10:44 am
by Bill H
Check out the ini_set() function.
upload_max_filesize is one of the items listed that can be changed in htaccess. Default is "2M"