KnowledgeBase Programming PHP IncreaseUploadMaxWednesday, January 20, 2016 11:42 AM
Increase Upload Max
When using a PHP script that receives a file upload you may find that large files cannot be uploaded. If this happens you may be hitting the limit set on the PHP environment for the size of files that will be received by the script.
Update your php.ini (BEST)
In some environments you will have access to add / edit a
php.ini file for your hosting server or account. If possible then you can add / edit the following rules to increase the maximum size, in this case to 128M (megabytes). This option will affect your entire server or account and is the least likely to be overwritten.
memory_limit = 128M upload_max_filesize = 128M post_max_size = 128M
Update your .htaccess (BETTER)
In some apache environments the
.htaccess file can be modified to include php ini directives. This option will affect requests to any scripts within the folder / subfolders where the
.htaccess file is located.
php_value memory_limit 128M php_value upload_max_filesize 128M php_value post_max_size 128M
Inline PHP command (GOOD)
In many applications a central configuration file will provide a reliable location to place manual runtime directives. This option will only affect the scripts on which the
ini_set commands are placed.
ini_set('memory_limit', '128M'); ini_set('upload_max_filesize', '128M'); ini_set('post_max_size', '128M');