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

This error message can announced when yous're uploading large images, videos, plugins, themes, any type of file that you upload to your WordPress site.

In this article, nosotros're going to aid you prepare the problem and make information technology so that you can upload those large files. In total, we'll cover:

  • What causes the uploaded file exceeds the upload_max_filesize directive in php.ini
  • How to set 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 case of the uploaded file exceeds the upload_max_filesize directive in php.ini

Let'southward commencement at the beginning. In gild to preserve your server'southward resources, hosts set 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 require PHP.

Those ii things – upload_max_filesize and php.ini – are what the mistake message you see is referencing.

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

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

As you can meet above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to e'er cause bug. Still, a lot of other hosts prepare the default as minor as just 2 MB or 4 MB.

That means if you lot try to upload a file larger than that limit, you're going to meet 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 gild to fix this error, you demand 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 unlike means you can practice this – the verbal method that you choose will depend on your preference and your host'south configuration.

1. Talk to your host's support

While we'll cover some methods that you can endeavor past yourself, the simplest solution is usually to just reach out to your host's support and ask them to increase the limit for yous.

This is a common request, your host'southward support should know exactly what you desire, and it should but take a couple of minutes of your time. That's what your host's back up is in that location for!

If you lot host at Kinsta and demand to increase your limit across the default 128 MB limit, y'all can reach 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, you should be able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

First, look for the MultiPHP INI Editor:

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

And so choose your WordPress site from the drop-downwardly. After that, you lot'll be able to edit the upload_max_filesize directive for that site:

Subscribe Now

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

Increase the value based on your needs.

3. Create or edit php.ini via FTP

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

Unfortunately, based on your host's restrictions, you lot 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 nosotros'll comprehend in the next department).

However, you can requite this a effort first to run into if you are allowed to utilise php.ini at your host.

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

If you already meet a php.ini file in the root binder, y'all tin 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 together or modify the code snippet below:

  • If yous created a new file, paste in the lawmaking snippet and modify the numbers to suit your needs.
  • If you're editing an existing file, find the same directives in the existing file and modify the numbers to suit 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 further require you to add the suPHP directive in your site's .htaccess file in order for the changes above to actually piece of work.

To do this, you lot tin also edit your .htaccess file via PHP and add together the post-obit code almost the peak of the file:

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

Make certain to supplant yourusername with the actual file path of your site.

4. Increase upload_max_filesize value by editing .htaccess

If direct creating or editing the php.ini file via the methods above didn't work, yous tin too try to modify the upload_max_filesize directive by editing your site's .htaccess file.

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

Then, add the following code snippet, making sure to accommodate 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 control php.ini file via .htaccess

If yous get an internal server error message subsequently calculation this lawmaking snippet, your server is likely running PHP in CGI fashion, which means you cannot utilize these commands in your .htaccess file. Remove the snippets you just added and your site should start performance again.

Annotation – if yous're a Kinsta customer, Kinsta uses NGINX, which means your site does not have an .htaccess file. If yous need help at Kinsta, nosotros recommend merely reaching out to our support team and they'll be able to chop-chop get things working for you.

Summary

To check if your changes are working, you can go back to Media → Add together New in your WordPress dashboard to encounter if the new maximum upload limit matches the number you 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 yous problems.

Finally, if nothing y'all've tried is working and your host's support tin't help for some reason, yous can ever upload the file via FTP equally a workaround. FTP has no limits and volition allow y'all upload everything from images to plugins and themes. Yous tin even bulk upload files if needed.


Relieve time, costs and maximize site performance with:

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

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to discover the programme that's right for you lot.