Edit .htaccess to increase PHP’s max file upload

To increase the upload file size limit on your website, you need to edit PHP’s configuration settings. Unfortunately, not everyone has their own web server, so most of the time people are constrained by the limits of shared hosting. But you can still modify your base php.ini file by creating your own php.ini with the edits that you want.

Your php.ini file needs to be in every folder that’s going to be affected, or at least in the folder where the php script is being called from. Unfortunately if you have dozens of folders that need this edit, then you’ll need dozens of php.ini files.

An alternative is to then use .htaccess. By just placing a.htaccess file in your root folder, all folders beneath it will also have the change. The code to change your PHP max file upload size is:

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000

You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits though.

Similar Posts:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.

9 comments On Edit .htaccess to increase PHP’s max file upload

Leave a reply:

Your email address will not be published.


Sliding Sidebar