Note: This troubleshooting guide may require that you make server-side changes to your website. If you are not comfortable making those changes, you will need to contact your hosting provider for assistance.

Sometimes, while uploading a theme/plugin or a file in media library, you may have seen an error message like this:

The uploaded file exceeds the upload_max_filesize directive

This will normally happen when the file being uploaded is larger than the allowed size for file uploaded on your server.

Troubleshooting Steps

  1. PHP.ini File - You need to go to wp-admin folder on your hosting file manager either via FTP or cPanel and look for php.ini file. If you are on some shared hosting, this file might not be visible to you, in that case you can create a new file there and name it php.ini and in this file you can write this line to increase the upload limit. upload_max_filesize = 64M
  2. HTACCESS File - For some hostings the above method might not work, in that case you can try using htaccess file. You need to go to root folder of your website via FTP and in edit the htaccess file there and add this line at the bottom of the htaccess file.
php_value upload_max_filesize 64M

3. WP-CONFIG File - If this method also does not work, you can try using wp-config.php file in root folder of your website file manager.You can add this line at the top of the file.

define('WP_MEMORY_LIMIT', '128M');

4. Functions.PHP File -  if this also does not work, you can try adding this line of code to functions.php file of your child theme.

@ini_set( 'upload_max_size' , '64M' );

5. From cPanel - In the cPanel, please go to Software section and click on the option for Select PHP Version

then on next screen, click on php options

Now you can click on required PHP directive to change the values

6. Contact your host - if  none of the steps above work, your web host has placed restrictions on these limits and it needs to be changed by them.

Note: Please make sure to take a complete backup of the site to perform these steps, as all the files mentioned above are critical files and not handling them well might bring the site down.

Did this answer your question?