Maximum Upload Filesize and how to Increase it

What Is “upload_max_filesize”?

"upload_max_filesize" is a PHP configuration setting that specifies the maximum size of a file that can be uploaded to a server. This setting is used by PHP to limit the size of uploaded files to prevent the server from running out of memory or disk space. The value of the "upload_max_filesize" setting is expressed in bytes, but can also be defined in megabytes or gigabytes by appending the letter M or G respectively.

When updating upload_max_filesize, you must put into consideration other directives

  • post_max_size, which must be larger than upload_max_filesize.
  • memory_limit, which should be larger than post_max_size.

For example, if the "upload_max_filesize" is set to 128M, it means that the maximum size of a file that can be uploaded is 128 megabytes. If you upload a file that is larger than this limit, you will receive an error message indicating that the file is too large.

To increase the upload max filesize on cPanel, you can follow these steps:

  • Login to your cPanel account
  • Go to the Software section and click on Selecet PHP Version
  • Find the upload_max_filesize option and increase its value to the desired value (e.g. 64M)
  • Click on the Apply button to save the changes.

For the new change to be reflected, this value should be at least as big as the post_max_size.
You can also increase the upload max filesize by adding the following code to your .htaccess file:

php_value upload_max_filesize 64M

It is important to set the "upload_max_filesize" value appropriately to ensure that your server can handle the size of uploaded files without running into performance or stability issues.