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

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

In this article, we're going to assist yous gear up the problem and make information technology so that y'all 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 beginning. In order to preserve your server'due south resources, hosts set 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 two things – upload_max_filesize and php.ini – are what the mistake message you see is referencing.

It's important to think that this upload limit is not a WordPress setting. However, you lot can encounter this limit in your WordPress site if yous go to Media → Add New:

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

As yous can see above, Kinsta sets the default limit at 128 MB, which is quite large and unlikely to ever crusade issues. Nevertheless, a lot of other hosts prepare the default as minor equally just ii MB or 4 MB.

That ways if yous endeavor to upload a file larger than that limit, you're going to come across the "the uploaded file exceeds the upload_max_filesize directive in php.ini", or a like 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, yous need to increase the file size upload limit. That is, you lot need to increase the value of the upload_max_filesize directive in your php.ini file.

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

1. Talk to your host'due south support

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

This is a mutual asking, your host'south support should know exactly what y'all desire, and information technology should only take a couple of minutes of your time. That's what your host's back up is at that place for!

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

Kinsta 24x7 support
WordPress host support

two. Edit php.ini via cPanel

If your host uses cPanel, you should exist able to edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

Commencement, look for the MultiPHP INI Editor:

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

Then choose your WordPress site from the drib-down. Subsequently that, you lot'll exist 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.

iii. Create or edit php.ini via FTP

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

Unfortunately, based on your host'south restrictions, you lot may or may not be able to utilise php.ini files. For that reason, a more than reliable arroyo tin sometimes exist to apply .htaccess (which nosotros'll embrace in the next section).

However, you tin give this a try first to see if you lot are immune to utilise php.ini at your host.

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

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

  • If you 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, observe the same directives in the existing file and modify the numbers to arrange your needs.

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

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

Some hosts might further require you lot to add together the suPHP directive in your site'south .htaccess file in club for the changes above to actually work.

To do this, you can as well edit your .htaccess file via PHP and add together the following lawmaking almost the height of the file:

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

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

4. Increase upload_max_filesize value past editing .htaccess

If direct creating or editing the php.ini file via the methods above didn't work, you can also try to modify the upload_max_filesize directive by editing your site'southward .htaccess file.

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

Then, add the following code snippet, making sure to conform 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 you get an internal server error message afterwards adding this code snippet, your server is likely running PHP in CGI mode, which means you cannot utilise these commands in your .htaccess file. Remove the snippets y'all just added and your site should start operation over again.

Annotation – if you're a Kinsta customer, Kinsta uses NGINX, which means your site does not have an .htaccess file. If you need assist at Kinsta, we recommend only reaching out to our back up team and they'll be able to quickly get things working for you.

Summary

To check if your changes are working, y'all tin get back to Media → Add New in your WordPress dashboard to see if the new maximum upload limit matches the number you ready in your php.ini file. If all goes well, yous should see your new value and you'll exist able to upload the file that was giving you issues.

Finally, if nothing you've tried is working and your host's back up can't help for some reason, you tin can always upload the file via FTP as a workaround. FTP has no limits and will allow yous 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 aid from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience achieve with 29 data centers worldwide.
  • Optimization with our congenital-in Application Functioning Monitoring.

All of that and much more, in i plan with no long-term contracts, assisted migrations, and a thirty-twenty-four hours-money-back-guarantee. Check out our plans or talk to sales to find the plan that'south right for you lot.