If you’re seeing ugly error message when uploading file to your WordPress website there’s a good chance you’re hitting the maximum file upload limit set by your server settings.
The good news this is easy to fix.
Method 1: Change your Ecenica web hosting PHP settings.
- Log in to cPanel.
- Click Select PHP Version.
- To set a custom upload_max_filesize setting you will need to select a PHP version other than native. Choose PHP 7, 5.6, 5.5, 5.4, 5.3 or 5.2 from the list and click Set as current.
- Click Switch To PHP Options
- Click the upload_max_filesize PHP value, choose an option and click Apply
- Click the post_max_size PHP value, set it to the same value as upload_max_filesize. Click Apply
- Click Save
If you are not using Ecenica web hosting, or do not have PHP Selector available, try one of the following methods.
Method 2: Edit your theme’s functions.php file.
- FTP in to your web space and download a copy of the active theme’s functions.php file. The path will be something like /wp-content/themes/mytheme/functions.php.
Add the following lines of code on a new line immediately after the opening <?php.
//Set Max Upload Size @ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' ); @ini_set( 'max_input_time', '300' );
Upload the file to your web space, making sure to upload to the same location.
Method 3: Edit your .htaccess file.
An advanced way of increasing your upload limit, but one which offers best performance – so worth a try.
Open your .htaccess file in your code editor of choice and add the following lines of code:
#Set Max Upload Size php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Tip: If you don’t have a code editor, login to your cPanel and use the File Manager tool.