Have you ever experienced a common error “The uploaded file exceeds the upload_max_filesize directive in php.ini” in WordPress? This usually happens when you are trying to upload larger files themes or images. In this article, we will explain the steps of fixing the error, in detail.
When does the error happen?
This error occurs when you are trying to upload a file larger than the given size. If you are trying to upload any file, image, or theme and it exceeds the given size then you will see this error message coming from the hosting server.
Steps to resolve the issue in the php.ini file:
But there is no need to worry about it. This error can be fixed by the following steps.
1) Edit your php.ini file from Cpanel:
If you are using cPanel, then the first thing you need to do is to update your php.ini and change upload_max_filesize from the dashboard.
Go to cPanel >> software>> MultiPHP INI Editor
Then add your hosting site and change the upload_max_filesize.
Once you change the size then do not forget to Apply changes.
2) Edit the .htaccess file
If the first step does not work then you can still fix the error by modifying the upload_max_filesize by updating the .htaccess file on your side panel.
In order to start, connect your server to the FTP guide
Download FTP>> Enter your host’s username and password>> Choose the file you need to download
Once you download the file, open the file in Visual code studio or in notepad. Then add the following code and change the value as per your need.
- php_value upload_max_filesize 128M
- php_value post_max_size 128M
- php_value memory_limit 128M
Save changes, close the application, go back to the website and check if you can upload the larger files or not.
3) Fix the error by editing the wp-config.php file:
This file contains important configuration details for your WordPress site. Without wp-config.php. File, you would not be able to get access to your site. Be very careful while editing this file.
- To start, connect to your website using the FTP client
- Add the host’s name, username, and password
- Download a file you need to as a safety net
- Now edit the file either in Visual code studio or in notepad.
- Add the following code under the /* That’s all, stop editing!
@ini_set(‘upload_max_size’ , ‘128M’ );
Make sure to save changes and check if the site is allowing you to upload a larger file.
4) Edit the php.ini file
If the following steps do not work then, try to edit the php.ini file and update the file size as per your need. To begin, move to the php.ini file of your website’s panel, find the upload_max_filesize and increase its number. After changes do not forget to save the file. Hopefully, this step will work.
5) Contact your host
The last step if you are not able to understand the following steps, is to contact your web hosting team. Their support team will get the error fixed and make your site workable.
All you need is to explain to them the complete situation and hopefully, they’ll resolve the problem.
Many of the users face the problem of getting errors while uploading a file larger in size. This article has detailed solutions for fixing the error. Here’s a quick recap of the steps
- Update the php.ini file from cPanel.
- Increase file size by editing values in the .htaccess file via FTP
- Edit wp-config.php file via FTP
- Increase file size by editing the php.ini file
- Last but not least contact the hosting team.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?