WordPress is the most popular content management system (CMS) to create websites from the most simple to the most complex. Since you don’t need to have deep knowledge of HTML and coding to use this great system, you can easily build and manage your website, customize its interface and add new functions. However, while using WordPress, you may face different kinds of errors. In today’s guide, we are going to talk about one of the most common ones; the uploaded file exceeds the upload_max_filesize directive in php.ini. What does this error mean? And how are we going to fix this error? Don’t worry; we are here to answer all the questions you have in mind. Now, we are going to introduce you to 4 ways to solve this error. You can;
- Contact your host provider, and ask them to adjust the maximum upload file size
- Edit the .htaccess file via hPanel, cPanel, or FTP
- Add a code line to your server’s root directory using WordPress
- Edit wp-config.php file
What Does The upload_max_filesize Error Mean?
In order to understand what the upload_max_filesize error exactly is, you should know that your web server has a limit on the maximum file size you can upload. When you try to upload a bigger file than this maximum size, you face the error. Let’s dive in!
4 Ways to Solve the upload_max_filesize Error
As we touched above, if you want to upload a bigger file than the maximum file size in WordPress, you are going to face the file size error. You can see this error on your WordPress site when uploading large files, plugins, images, videos, themes, or any type of file that you upload.
Let’s say you are trying to upload a new file to your WordPress site. However, the system does not allow it because your file exceeds the maximum file size. In other words, the only way is to fix this error is to increase your maximum upload file size. So, how are you going to do this?
Now, we are going to teach you four methods to fix this common error. Let’s start with the easiest one.
Contact Your Host Provider
Above all, the easiest and fastest way to solve the ‘uploaded file exceeds the upload_max_filesize directive in php.ini’ error is to contact your hosting provider and ask them to increase the upload file size limit for you.
Adjust The upload_max_filesize Error by Editing The .htaccess File
Another straightforward way for the file size error is to adjust the maximum upload file size by editing the .htaccess file. Here are the steps to do this.
Time needed: 5 minutes.
Here is how to fix the error via hPanel.
- Firstly, log in to hPanel and launch File manager under the Files section on the screen
- Right-click on the .htaccess file and click Edit
- Modify the numbers as you need or add the following code snippet; php_value upload_max_filesize 256M (This number can vary.)
Save the changes. That’s all. This code snippet will change your server-side limit, so you will be able to upload a file up to 256 MB.
- Click “MultiPHP INI Editor” in your cPanel
- Select your WordPress site. You should see the upload_max_filesize directive or ‘The maximum size of an uploaded file.’ Here, change the current value to the number you want.
- Firstly, access your server through FTP
- Go to your site’s root directory
- In the root folder, find the php.ini file. If you can’t, create a new file and name it php.ini
- Paste the following code snippet to the php.ini file
- php_value upload_max_filesize = 10M
- php_value post_max_size = 10M
- php_value memory_limit = 10M
- php_value file_uploads = 0
- php_value max_execution_time = 10 (The numbers can vary based on your needs.)
- Finally, save the changes
Since you may need a suPHP in the .htaccess file to run the code, you will need to add the following code snippet to the bottom of your file.
Hint: To clarify, this method can only be used if your web hosting provider allows you to access your php.ini file.
Adjust The upload_max_filesize Error by Editing The wp-config.php File
You can also change the upload file size limit by adjusting the wp-config.php file. Here are the steps you can follow to do this.
- Firstly, log in to the server where your WordPress site is hosted
- Access your cPanel dashboard
- Open the public_html folder
- Right-click on the wp-config.php file and click Edit
- Add the following line to the bottom of your wp-config.php file and modify the number based on your needs.
- @ini_set( ‘upload_max_size’ , ‘10M’ )
- Finally, save the changes
Fix The Error Using WordPress
- Access your server’s root directory
- Paste the following code to the bottom of your file
These two easy steps will help you set the maximum upload file size limit to 100 megabytes. However, if you want to upload bigger files, you can modify the number accordingly.
FAQs About The upload_max_filesize Error
Go to your Media section in your WordPress dashboard and click on the Add New option. At the bottom of the file, there is a text like ‘Maximum upload file size: 4M’ 4 MB refers to the maximum file size you can upload.
Unfortunately, it is not possible to do this. The only way to upload larger files to your WordPress site is to adjust the maximum file size on your server.
In some cases, your .htaccess file may not contain this code snippet. However, you can paste the code we gave above to the end of the file and adjust it to whatever you want to be your new maximum file size.
To ensure you won’t encounter this error in WordPress when uploading large themes, videos, plugins, or images, you can go to Media > Add New in your dashboard and check the maximum upload limit values.
You should get technical support from your host provider.
Final Thoughts on the upload_max_filesize Error
To sum up, web hosts set a limit on the maximum size of the files you can upload. However, sometimes, you need to upload bigger files. When you try to do it, you face the uploaded file exceeds the upload_max_filesize directive in php.ini error. Although the error seems like a big problem, it only takes a couple of minutes to get rid of it. Today, we have talked about the top 4 methods to do it. Moreover, the easiest way is to contact your host provider. Another way is to adjust the error by editing the .htaccess file. In this case, you can use hPanel, cPanel, or FTP. Also, you can edit the wp-config.php file if you want to upload larger files to your WordPress site.