PHP : Set upload file size

By | September 30, 2011

To increase (or decrease) the size of allowed uploaded file size with PHP, using php.ini or .htaccess file, just add or edit the following values :

php_value upload_max_filesize <VALUE>
php_value post_max_size <VALUE>

Just add the amount instead the <VALUE> tag.  Let’s assume you want to allow 300 megabyte file size to be uploaded to the server…

php_value upload_max_filesize 300M
php_value post_max_size 300M

If you modify directly to php.ini, you may need to reload Apache to make it work.  If you used htaccess file, you are not required to do anything (Apache read htaccess file each time your Web site is visited).