How to fix the upload_max_filesize Error in WordPress ?

A limit is set to the PHP memory by the web hosting providers. So, you cannot add files to the web that exceeds the limit. If your file exceeds the limit, then an error message will show up saying “the uploaded file exceeds the upload_max_filesize directive in php.ini”. There are different methods available to solve the issue, so let's look into these.

    I) Edit the .htaccess file

1. First, log into your cPanel then click on the File manager option present under the Files section.

2. Then find out the .htaccess file, right-click on it. Then click on Edit. If you don't find the .htaccess file then do the following

- Click settings in the top right corner of the file manager dashboard
- select show hidden files.


3. A confirmation window will open, to confirm it click on the Edit button.


4. Include the code given below in the file.

php_value upload_max_filesize 256M​



5. Click on Save Changes.
    This might fix your problem. If not then check out the second method.


      II) By editing the wp-config.php file

1. Log into your cPanel, then go to public_html. Find wp_config.php file, right-click on it and click on Edit.                                                                         


2. Then a confirmation window will open, here click on the Edit button. 


3. Find the line that says, “That’s all, stop editing! Happy publishing” and before this line add the codes given below:

@ini_set('upload_max_size' , '256M' );​


4. At last click on the Save Changes button. Try to upload your file after refreshing the browser tab. 
   
   III) By updating php.ini

1. First log into cPanel.
2. Then find out the file named php.ini, right-click on it, and click on the Edit option.


3. Find out the line containing "upload_max_filesize" then increase the memory according to your need.

upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 180​



4. At last click on the Save button to save all the changes made. 

     
    IV) By editing the php.ini file through cPanel

1. First, log into cPanel.

2. Under the Software section click on MultiPHP INI Editor.


3. From the drop-down select your WordPress website. Then edit the upload_max_filesize directive. 


4. Next click on the Apply button.
 
 
       If none of the above methods solves your issue then contact the customer care support of your hosting provider. Tell them about the issue. They might help you to resolve the issue.

Did you find this article useful?