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

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

In this article, we're going to assistance you set the problem and arrive so that you lot 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 fix 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

Let's start at the kickoff. In social club to preserve your server's resources, hosts ready a limit on the maximum size of a file that can be uploaded.

This maximum, in megabytes, is divers 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 2 things – upload_max_filesize and php.ini – are what the error message you encounter is referencing.

It'due south important to remember that this upload limit is not a WordPress setting. All the same, you can see this limit in your WordPress site if you go to Media → Add New:

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

As you can see above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to e'er cause issues. However, a lot of other hosts gear up the default as pocket-sized every bit just 2 MB or 4 MB.

That ways if you effort 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 bulletin 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 club to fix this error, you need to increase the file size upload limit. That is, you demand to increment the value of the upload_max_filesize directive in your php.ini file.

There are several different ways you lot can practice this – the exact method that you cull will depend on your preference and your host's configuration.

ane. Talk to your host's back up

While we'll comprehend some methods that you lot can endeavor by yourself, the simplest solution is commonly to simply attain out to your host's back up and ask them to increase the limit for you.

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

If you host at Kinsta and demand to increase your limit across the default 128 MB limit, you lot tin can attain out to support on Intercom from anywhere in your Kinsta dashboard:

Kinsta 24x7 support
WordPress host support

ii. 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.

Showtime, look for the MultiPHP INI Editor:

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

So cull your WordPress site from the drib-down. Later on that, you'll be able to edit the upload_max_filesize directive for that site:

Subscribe Now

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

Increase the value based on your needs.

three. 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, yous 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).

However, you tin give this a try get-go to see if y'all are allowed to utilise php.ini at your host.

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

If you already see a php.ini file in the root folder, you 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 beneath:

  • If y'all created a new file, paste in the code snippet and modify the numbers to accommodate 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 farther require you to add the suPHP directive in your site's .htaccess file in order for the changes higher up to really work.

To do this, you can as well edit your .htaccess file via PHP and add the post-obit code near the top of the file:

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

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

iv. Increase upload_max_filesize value by editing .htaccess

If direct creating or editing the php.ini file via the methods above didn't work, you can as well try to change the upload_max_filesize directive by editing your site'due south .htaccess file.

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

And then, add the following lawmaking snippet, making certain 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 control php.ini file via .htaccess

If you become an internal server error message afterwards calculation this code snippet, your server is likely running PHP in CGI mode, which means you cannot use these commands in your .htaccess file. Remove the snippets you just added and your site should showtime functioning once again.

Note – if yous're a Kinsta client, Kinsta uses NGINX, which means your site does non have 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 quickly get things working for you.

Summary

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

Finally, if nothing y'all've tried is working and your host'due south back up can't help for some reason, you can always upload the file via FTP as a workaround. FTP has no limits and volition let y'all upload everything from images to plugins and themes. You can even bulk upload files if needed.


Save fourth dimension, costs and maximize site functioning with:

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

All of that and much more than, in i program with no long-term contracts, assisted migrations, and a 30-twenty-four hour period-coin-back-guarantee. Check out our plans or talk to sales to observe the program that'due south correct for you.