The uploaded file exceeds the upload_max_filesize directive in php ini
Trying to upload something to your WordPress site only to encounter a message saying “the uploaded file exceeds the upload_max_filesize directive in php.ini”?
This error message can appear when you are uploading large images, videos, plugins, themes, any type of file that you upload to your WordPress site.
In this article, we will help you fix the problem and do it so that you can upload those large files. In total, we will cover:
What causes the uploaded file to exceed 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 to exceed the upload_max_filesize directive in php.ini <img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-0.png" alt="An example of the
- uploaded file exceeds
- the upload_max_filesize directive in php.ini
Let’s start at the beginning. To preserve their server 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 policy.
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 error message you see refers to.
It’s important to remember that this upload limit is not a WordPress setup. However, you can see this limit on your WordPress site if you go to Media → Add New:
<img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-2.png" alt="How to check upload limit in WordPress
upload limit in WordPress
As you can see above, Kinsta sets the default limit to 128 MB , which is quite large and unlikely to ever cause trouble. However, many other hosts set the default value as small as only 2 MB or 4 MB.
That means if you try to upload a file larger than that limit, you’ll see 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 uploaded file exceeds upload_max_filesize directive in php.ini
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 different ways to do this: the exact method you choose will depend on your preference and your host configuration.
1. Talk to your host’s support
While we’ll cover some methods you can try yourself, the simplest solution is usually to simply contact your host’s
support and ask them to increase the limit for you. This is a common request, your
know exactly what you want, and it should only take a couple of minutes of your time. That’s what your host’s support is for!
If you host on Kinsta and need to increase your limit beyond the default 128 MB, you can contact Support within the MyKinsta dashboard and request that change
: <img src="https://kinsta.com/wp-content/uploads/2022/10/mykinsta-send-message.png" alt="Screenshot: Sending a message on MyKinsta.
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 through the cPanel control panel
First, look for the MultiPHP INI Editor:
<img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-5.png" alt="The MultiPHP INI editor in
Then choose your WordPress site from the drop-down menu. After that, you will be able to edit the upload_max_filesize policy for that site:
<img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-6.png" alt="Change upload_max_filesize policy in
Increase the value according to your needs
3. Create or edit php.ini via FTP
As you learned earlier, the php.ini file controls how your server for PHP applications works
Unfortunately, depending 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).
However, you can test this first to see if you are allowed to use php.ini on your host.
To get started, connect to your server via FTP and go to your site’s root folder.
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 file.ini Then add or modify the code snippet below: If you created
, paste the code
- and modify the numbers to suit your needs.
- If you are editing an existing file, look for the same policies in the existing file and modify the numbers to suit your needs.
upload_max_filesize = 12M post_max_size = 13M memory_limit = 15M
<img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-4.png" alt="Add the code to the php.ini
Some hosts may require you to add the suPHP directive in the . htaccess of your site so that the above changes really work.
To do this, you can also edit your . htaccess via PHP and add the following code near the top of the file:
mod_suphp.c> suPHP_ConfigPath /home/yourusername/public_html </IfModule>
Be sure to replace your username with the actual path of your site’s file
4. Increase upload_max_filesize value
by editing .htaccess
If directly creating or editing the php.ini file through the above methods did not work, you can also 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 found in your site’s root folder.
Then, add the following code snippet, making sure to adjust the values according to your needs:
php_value upload_max_filesize 12M php_value post_max_size 13M php_value memory_limit 15M
<img src="https://kinsta.com/wp-content/uploads/2019/04/upload-max-filesize-7.png" alt="How to control php file.ini via .htaccess
If you receive an internal server error message after adding this code snippet, it’s likely that your server is running PHP in CGI mode, which means you can’t use these commands in your . htaccess. Remove the snippets you just added and your site should start working again.
Note: If you’re a Kinsta customer, Kinsta uses NGINX, which means your site doesn’t have an .htaccess file. If you need help on Kinsta, we encourage you to contact our support team and they will be able to get things running quickly for you.
To check if your changes are working, you can go back to Media → Add New in your WordPress dashboard to see 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 can upload the file that was giving you problems.
Finally, if nothing you’ve tried works and your host’s support can’t help for some reason, you can always upload the file via FTP as a workaround. FTP has no limits and will allow you to upload everything from images to plugins and themes. You can even upload files in bulk if needed.