The uploaded file exceeds the maximum allowed size in your php configuration file

By default, PHP allows uploading maximum 2 MB file on the server. But you can change the maximum size of file upload as per your requirement. Using the PHP configuration file (php.ini), you can increase or decrease the file upload size in PHP.

The upload_max_filesize and post_max_size variable’s value need to be modified in php.ini file. Follow the below steps to increase the limit of file upload size in PHP.

  • Open the php.ini file in the text editor.
  • Search for upload_max_filesize variable and specify the size which you want to increase.
    upload_max_filesize = 128M
  • Search for post_max_size variable and specify the size which you want to increase. (Basically it same as upload_max_filesize variable value)
    post_max_size = 128M
  • Once done, save the modified php.ini file and restart the server.

Jul 29, 2022

Domantas G.

3min Read

Most hosting providers set limits to the PHP memory designated for running applications and scripts. The uploaded file exceeds the upload_max_filesize directive in php.ini is an error that occurs on your WordPress site when you upload a file that exceeds the limitations set by your webserver.

Download Ultimate WordPress Cheat Sheet

As scary as this error may seem, the solutions are pretty straight-forward. In this tutorial, you will learn how to debug this WordPress error by increasing the default limit of upload_max_filesize through a few methods.

  • How to Fix the upload_max_filesize Error
    • Method 1. Editing the .htaccess File
    • Method 2. Editing the wp-config.php File
    • Method 3. Updating php.ini to Fix the upload_max_filesize Error
    • Method 4. Making Changes to PHP Configurations on hPanel
    • Method 5. Contacting Customer Support to Fix the upload_max_filesize Error

How to Fix the upload_max_filesize Error

The solution, as you might have guessed, involves increasing the default limit of upload_max_filesize. Let’s dive into it and see what steps we can take to fix this WordPress error.

Method 1. Editing the .htaccess File

The quickest fix for the uploaded file exceeds the upload_max_filesize directive in php.ini error is increasing your PHP resource limits by tweaking the .htaccess file. Here’s how to do it:

  1. Login to hPanel and navigate to File Manager under the Files section.

The uploaded file exceeds the maximum allowed size in your php configuration file

2. Locate the .htaccess file and right-click to Edit.

The uploaded file exceeds the maximum allowed size in your php configuration file

3. Add the following line at the bottom of the file:

php_value upload_max_filesize 256M

and Save the changes.

That’s it! Increasing the upload_max_filesize value should automatically fix the error.

Try uploading your file again and if the error persists, increase additional PHP limits by adding these lines into the .htaccess file :

php_value upload_max_filesize 128M

Pro Tip

Adjust the PHP limits to any desired values as long as your web hosting providers support it. You can also locate the maximum available limits by checking the PHP info of your website.

Method 2. Editing the wp-config.php File

Another way to get rid of the uploaded file exceeding the upload_max_filesize directive in php.ini error is by tweaking the wp-config.php file located in your root directory.

All you need to do is log in to the hPanel and access public_html to edit the wp_config. php file. Add the following line before the “That’s all, stop editing! Happy publishing” line:

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

The uploaded file exceeds the maximum allowed size in your php configuration file

Now Save the file, refresh your web browser, and try uploading again!

Method 3. Updating php.ini to Fix the upload_max_filesize Error

If you look closer at the uploaded file exceeds the upload_max_filesize directive in php.ini error message, we can safely assume that it has something to do with php.ini, a file that holds all of the PHP related variables.

If you’re using shared web hosting by Hostinger, all limits are already at the maximum value for user convenience, so it’s not possible to alter php.ini.

However, you can always modify your PHP settings through the PHP Configuration tool on hPanel if you wish.

If you’re using VPS or a different platform, you can try updating php.ini to fix the error. Here’s what you need to do:

  1. Navigate to your php.ini file and edit it. If you can’t find it, ask for assistance from your hosting providers.
  2. Locate the upload_max_filesize and increase it by changing its number. You can also boost a few other limitations, as shown below: upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180
  3. Save the file, and that’s it. The error should no longer occur.

Method 4. Making Changes to PHP Configurations on hPanel

For Hostinger clients, modifying PHP configurations can’t get any easier. Hostinger offers a custom-built tool to edit and adjust the PHP settings of your hosting account.

Log in to hPanel and head to PHP Configuration under Advanced.

The uploaded file exceeds the maximum allowed size in your php configuration file

Then, switch to the PHP Options menu and scroll down to find upload_max_file row and make changes as needed.

The uploaded file exceeds the maximum allowed size in your php configuration file

Method 5. Contacting Customer Support to Fix the upload_max_filesize Error

If none of the options above fixed the error, try contacting your web hosting support team.

Explain the situation and let them know what steps you took to fix the WordPress error, and hopefully, they’ll resolve the problem for you.

If you’re a Hostinger client, our customer success agents are ready to help you out 24/7 through our live chat feature. Log in to the hPanel and access the chat feature at the bottom right of your dashboard.

Conclusion

In this tutorial, you have learned five different ways to fix the uploaded file exceeds the upload_max_filesize directive in php.ini error in WordPress. Here’s a quick recap:

  • Increasing upload_max_filesize and other PHP values through the .htaccess file
  • Setting higher upload_max_filesize through the wp-config.php file
  • Editing php.ini file to increase upload_max_filesize
  • Editing and adjusting PHP configurations through the PHP Configuration feature on hPanel
  • Contacting your hosting providers for assistance

Easy, right? If you have any questions or suggestions, don’t hesitate to comment down below!

Domantas leads the content and SEO teams forward with fresh ideas and out of the box approaches. Armed with extensive SEO and marketing knowledge, he aims to spread the word of Hostinger to every corner of the world. During his free time, Domantas likes to hone his web development skills and travel to exotic places.

How do I change the maximum upload file size in PHP?

How to Increase File Upload Size in PHP.
Open the php. ini file in the text editor..
Search for upload_max_filesize variable and specify the size which you want to increase. upload_max_filesize = 128M..
Search for post_max_size variable and specify the size which you want to increase. ( ... .
Once done, save the modified php..

How do I fix maximum file size exceeded?

How to Fix the File Size Exceeds Limit Error 0x800700DF in....
Set Your File System as NTFS. If your file system is currently set to FAT32, you will have no problem transferring files as long as their size doesn't exceed 4GB. ... .
Use the Registry Editor. ... .
Enable the WebClient Service. ... .
Scan Your Computer..

How do you fix this error the uploaded file exceeds the upload_max_filesize directive in PHP ini?

How to Fix the uploaded file exceeds the upload_max_filesize directive in php. ini. In order to fix this error, you need to increase the file size upload limit. That is, you need to increase the value of the upload_max_filesize directive in your php.

How can I change maximum upload file size in PHP in cPanel?

How to increase the upload_max_filesize limit in cPanel.
Log into cPanel..
Look for the SOFTWARE section and click on Select PHP version. ... .
In the new window click on the Switch To PHP Options link. ... .
Here you can locate the upload_max_filesize and click on the value..