{"id":11585,"date":"2022-01-13T16:59:35","date_gmt":"2022-01-13T21:59:35","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=11585"},"modified":"2022-01-13T16:59:36","modified_gmt":"2022-01-13T21:59:36","slug":"increase-maximum-file-upload-size-php","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/increase-maximum-file-upload-size-php\/","title":{"rendered":"How to Increase Maximum File Upload Size In PHP"},"content":{"rendered":"\n
In this guide, we will walk you through how to increase the maximum file upload size in PHP<\/a>. The best way to modify the maximum file upload size is to set the values in the php.ini file.<\/p>\n\n\n\n There are two directives in the php.ini file that you will need to change which are:<\/p>\n\n\n\n To increase the maximum file upload size to 64MB in PHP for example you would enter the directives as follows:<\/p>\n\n\n\n For the changes to take effect you then need to restart your web server.<\/p>\n\n\n\n Versions prior to PHP 5.3 these values could be set via the ini_set PHP function at runtime. However, newer versions of PHP will not allow you to modify these values via the ini_set function because the two directives involved are PHP_INI_PERDIR. Learn more here<\/a>.<\/p>\n\n\n\n Being PHP_INI_PERDIR you can create a Just for reference, you can use the ini_set function like so in your PHP script:<\/p>\n\n\n\n If your server configuration does not restrict you from overriding PHP values using a .htaccess file, then you can do this:<\/p>\n\n\n\n There you have it! You now know how to increase the maximum file upload size in PHP. We recently published a guide showing you how to increase file upload size in Apache here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" In this guide, we will walk you through how to increase the maximum file upload size in PHP. The best way to modify the maximum file upload size is to…<\/p>\n","protected":false},"author":1,"featured_media":11587,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16],"tags":[58,193,313,433,449,452,526,531,544,573,635,638],"yoast_head":"\nupload_max_filesize<\/code>. It is best practice to set this higher to account for the overall size of the post request. The default value for this directive is 8MB.<\/li><\/ul>\n\n\n\n
upload_max_filesize = 64M\npost_max_size = 96M<\/code><\/pre>\n\n\n\n
.user.ini<\/code> file, add the above values for upload and post max sizes and place it in the same directory as the upload script.<\/p>\n\n\n\n
ini_set( 'upload_max_filesize', '64M' );\nini_set( 'post_max_size', '96M' );<\/code><\/pre>\n\n\n\n
Increase Maximum File Upload Size Using .htaccess File<\/h2>\n\n\n\n
<IfModule mod_php7.c>\n php_value upload_max_filesize 64M\n php_value post_max_size 96M\n<\/IfModule><\/code><\/pre>\n\n\n\n