Jump to content

Setting POST_MAX_SIZE at runtime


jamesm6162

Recommended Posts

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?

Link to comment
Share on other sites

If you don't have access to the master php.ini, it is unlikely that you have access to the httpd.conf file, which is the Apache server configuration file.

 

What happened when you used the .htaccess and what statement did you put in it?

 

Is php running on your server as an Apache module or as a CGI wrapper?

Link to comment
Share on other sites

Okay I used the php_flag once to set magic_quotes_gpc to off. (this worked fine with my localhost server)

That caused an internal server error whenever I tried to access by pages through the browser.

Any other suggestions?

 

ONE More thing:

If I do end up not being able to set it, and the user tries to upload something larger than the post max size then I receive an E_WARNING error message even before any code is executed on the receiving script.

How do I "catch" it then and display output of my choice when this does in fact happen?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.