Php POST Content-Length error. Got a solution :)

Hi there,

yesterday I spent all day trying to upload files onto my server via a browser. Worked fine with small files, but with big ones a nasty error was printed at the top of the page:

php POST Content-Length of bytes xxx exceeds the limit of xxx

I found out that the limit is stored in php.ini and to be able to upload large files, I needed to change post_max_size, upload_max_filesize and max_execution_time (to increase the time for an upload). Unfortunately I could not, I don’t have access to this file.

So, to the point.
If you are in the same situation, there is a light in the end of the tunnel for you.
On another forum I found a solution to this problem.

All you have to do is to create (or modify) your .htaccess file and increase php’s capabilites with these lines:


php_value post_max_size your_valueM (eg. 30M)
php_value upload_max_filesize your_valueM (eg. 18M)
php_value max_execution_time your_value (eg. 500)

you can paste this piece of code to any of your page to print out the values:


print ini_get('post_max_size'). ' - '.ini_get('upload_max_filesize'). ' - '.ini_get('max_execution_time');


After altering my .htaccess file I finally was able to upload large files without producing that annoying error.

Cheers,
G.

Thanks for the information, I may need that on a future project that I am going to be working on!

Regards,
Karl