jamesm6162 Posted June 28, 2008 Share Posted June 28, 2008 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? Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted June 28, 2008 Share Posted June 28, 2008 You can try using ini_set if you dont have access to the actual file. <?php ini_set("POST_MAX_SIZE", "someValue"); ?> -- DJ Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 28, 2008 Share Posted June 28, 2008 Post max size is only settable in the master php.ini, a .htaccess file (when php is running as an apache module), in a local php.ini (when php is running as a CGI wrapper), or in httpd.conf. Quote Link to comment Share on other sites More sharing options...
jamesm6162 Posted June 28, 2008 Author Share Posted June 28, 2008 It sounds like httpd.conf is my only option as the .htaccess didn't work. I don't have an idea how to, though. Could you please explain it to me? Thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 28, 2008 Share Posted June 28, 2008 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? Quote Link to comment Share on other sites More sharing options...
jamesm6162 Posted June 28, 2008 Author Share Posted June 28, 2008 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.