Trying to upload something to your WordPress site only to be met with a message saying "the uploaded file exceeds the upload_max_filesize directive in php.ini"?

This fault message tin appear when you're uploading large images, videos, plugins, themes, whatever type of file that you upload to your WordPress site.

In this commodity, we're going to help you prepare the problem and make it and so that you tin can upload those large files. In total, we'll comprehend:

  • What causes the uploaded file exceeds the upload_max_filesize directive in php.ini
  • How to prepare the uploaded file exceeds the upload_max_filesize directive in php.ini

What Causes the uploaded file exceeds the upload_max_filesize directive in php.ini

An example of the uploaded file exceeds the upload_max_filesize directive in php.ini
An example of the uploaded file exceeds the upload_max_filesize directive in php.ini

Permit'southward start at the beginning. In society to preserve your server'southward resources, hosts prepare a limit on the maximum size of a file that can be uploaded.

This maximum, in megabytes, is defined in the upload_max_filesize directive.

The upload_max_filesize directive itself is located in the php.ini file, which is the default server configuration file for applications that crave PHP.

Those two things – upload_max_filesize and php.ini – are what the error bulletin you come across is referencing.

It's important to remember that this upload limit is not a WordPress setting. Even so, you lot can see this limit in your WordPress site if you go to Media → Add New:

How to check upload limit in WordPress
How to bank check upload limit in WordPress

As you can see above, Kinsta sets the default limit at 128 MB, which is quite big and unlikely to ever cause bug. Notwithstanding, a lot of other hosts gear up the default every bit small equally just two MB or 4 MB.

That means if you endeavour to upload a file larger than that limit, you lot're going to see the "the uploaded file exceeds the upload_max_filesize directive in php.ini", or a similar message like "file_name exceeds the maximum upload size for this site."

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.ini file.

There are several dissimilar ways y'all can do this – the exact method that yous choose will depend on your preference and your host'south configuration.

1. Talk to your host'south back up

While nosotros'll cover some methods that you lot can try by yourself, the simplest solution is normally to but achieve out to your host's support and ask them to increase the limit for you.

This is a common asking, your host'southward support should know exactly what you want, and it should only have a couple of minutes of your time. That'southward what your host's support is there for!

If you host at Kinsta and demand to increment your limit beyond the default 128 MB limit, you can accomplish out to support on Intercom from anywhere in your Kinsta dashboard:

Kinsta 24x7 support
WordPress host support

2. Edit php.ini via cPanel

If your host uses cPanel, y'all should be able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

First, await for the MultiPHP INI Editor:

The MultiPHP INI Editor in cPanel
The MultiPHP INI Editor in cPanel

Then choose your WordPress site from the drop-downward. Afterwards that, y'all'll be able to edit the upload_max_filesize directive for that site:

Subscribe At present

Changing the upload_max_filesize directive in cPanel
Changing the upload_max_filesize directive in cPanel

Increase the value based on your needs.

iii. Create or edit php.ini via FTP

As yous learned above, the php.ini file controls how your server works for PHP applications.

Unfortunately, based on your host's restrictions, you may or may not be able to use php.ini files. For that reason, a more reliable approach can sometimes be to use .htaccess (which we'll cover in the next section).

Withal, you lot can requite this a try first to see if you lot are immune to use php.ini at your host.

To get started, connect to your server via FTP and go to your site's root folder.

If yous already see a php.ini file in the root binder, y'all can edit that file. Otherwise, create a new file and name it php.ini:

How to create a new php.ini file
How to create a new php.ini file

Then add or modify the code snippet below:

  • If you lot created a new file, paste in the code snippet and modify the numbers to suit your needs.
  • If y'all're editing an existing file, find the aforementioned directives in the existing file and modify the numbers to adjust your needs.

upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M

Adding the code to the php.ini file
Adding the code to the php.ini file

Some hosts might farther require you to add together the suPHP directive in your site's .htaccess file in order for the changes to a higher place to actually piece of work.

To practice this, you lot tin can also edit your .htaccess file via PHP and add the following lawmaking nigh the elevation of the file:

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/yourusername/public_html
</IfModule>

Make sure to supervene upon yourusername with the actual file path of your site.

4. Increment upload_max_filesize value past editing .htaccess

If directly creating or editing the php.ini file via the methods above didn't work, you can likewise try to modify the upload_max_filesize directive past editing your site's .htaccess file.

To become started, connect to your site via FTP and edit the .htaccess file that's located in your site's root binder.

And so, add together the following code snippet, making sure to adjust the values based on your needs:

php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M

How to control php.ini file via .htaccess
How to command php.ini file via .htaccess

If yous get an internal server fault message subsequently calculation this code snippet, your server is likely running PHP in CGI style, which means you cannot use these commands in your .htaccess file. Remove the snippets you just added and your site should start functioning over again.

Note – if you're a Kinsta client, Kinsta uses NGINX, which means your site does not accept an .htaccess file. If you need aid at Kinsta, we recommend just reaching out to our back up team and they'll be able to rapidly get things working for you.

Summary

To bank check if your changes are working, you can become back to Media → Add New in your WordPress dashboard to run into if the new maximum upload limit matches the number you lot set in your php.ini file. If all goes well, you should see your new value and you'll be able to upload the file that was giving you problems.

Finally, if nothing you lot've tried is working and your host'southward support can't assistance for some reason, you can always upload the file via FTP equally a workaround. FTP has no limits and will let you upload everything from images to plugins and themes. You can even majority upload files if needed.


Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 29 information centers worldwide.
  • Optimization with our congenital-in Awarding Performance Monitoring.

All of that and much more, in ane programme with no long-term contracts, assisted migrations, and a thirty-day-coin-back-guarantee. Check out our plans or talk to sales to find the programme that's right for you.