5 Steps to Fix the upload_max_filesize Error

file size error

If you’re seeing the error message “the uploaded file exceeds the upload_max_filesize directive in php.ini”, you probably just tried to upload a huge image, video, plugin or theme to your WordPress website. This is one of the longer error messages you’ll encounter as you work on your domain, but it’s actually really easy to understand, once you know what all its components mean.

Understanding your file size error message

What does “the uploaded file exceeds the upload_max_filesize directive in php.ini” even mean?

To understand this error message, the first thing you need to know is that web hosts set a limit on the maximum size of a file that can be uploaded. This prevents your server from being overloaded. The upload_max_filesize directive is the maximum size, in megabytes, of a file that can be uploaded to your server.

For instance, if your upload_max_filesize directive is set to 25M, you can’t upload any file bigger than 25 megabytes. The upload_max_filesize directive is found in the php.ini file.

So, the error message “the uploaded file exceeds the upload_max_filesize directive in php.ini” means that the file you’re trying to upload is bigger than the maximum size allowed by the upload_max_filesize directive, which is located in the php.ini file.

Should you adjust your upload_max_filesize limit?

The upload_max_filesize limit is really only there to protect you. It helps ensure that you don’t use too many of your server’s resources to unnecessarily upload massive files. It’s okay to change your maximum file size; it won’t have any adverse effect on your server or anything.

But even when you increase your limit, remember that bigger files slow down your website’s page load speed. So, before you upload any file, check to make sure it’s as small as you can get it. This will help make your website more efficient and reduce your bounce rate.

If you’ve gotten the file as small as it can get, but it’s still bigger than your file size limit, here are five steps you can take to fix it:

5 steps to fix the upload max file size in php.ini

1. Ask your web host to increase your upload_max_filesize directive

Later in the guide, we’ll cover some steps you can take to fix the error yourself. However, the easiest thing to do is to reach out to your web host and ask for the upload_max_filesize to be set to a bigger limit. Web hosts get asked for this all the time. So a good web host will know exactly what you’re asking for, as well as how to do it quickly.

2. Use cPanel to increase your upload_max_filesize directive

One of the best things about cPanel is that it allows you to make simple changes (like your upload_max_filesize directive) on your own. To increase your maximum file size, simply head to your cPanel and find the icon labelled “MultiPHP INI Editor”. (It should be somewhere under Software.)

Once the page opens, select your website. You’ll see lots of different settings that you can edit. Scroll down until you see “upload_max_filesize” and change it to the number you want to be your new maximum file size. (This goes without saying, but make sure you choose a limit that’s bigger than the file you’re currently trying to upload.)

3. Use FTP to increase your maximum file size

If your Host lets you access your php.ini file, you can increase the upload_max_filesize directive on your own.

First, you’ll need to use an FTP client to connect to your server. Once you’ve done that, head to your directory and look for the php.ini file.

When you find the file, add this code to it:

upload_max_filesize = 2M
post_max_size = 3M
memory_limit = 5M
file_uploads = Onmax_execution_time = 300

If your web host requires a suPHP in .htaccess file to run the code, you’ll need to add this code to your .htaccess file:

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

Instead of “username”, write your actual path. Web hosts use different configurations, so check with your host to make sure these are the correct configurations for your server.

4. Use .htaccess to increase the upload_max_filesize directive

Some web hosts don’t let you access your php.ini file. In this case, you can use .htaccess to increase your maximum file size. To do this, connect to your website via FTP and edit the .htaccess file in your website’s root folder.

Add this code snippet, adjusting the values according to your needs:

php_value upload_max_filesize 15M
php_value post_max_size 14M
php_value memory_limit 20M
php_value max_execution_time 300
php_value max_input_time 300

5. Increase upload_max_filesize in WordPress

To do this, use an FTP client to connect to your server’s root directory, and paste this code to the bottom of your wp-config.php file:

Define('WP_MEMORY_LIMIT', '258M');

This will change your upload size limit to 258 megabytes. If you think you’ll need a bigger limit, adjust accordingly.

To check if your changes were applied, head to your WordPress dashboard and go to Media >> Add New. Look at the maximum upload limit to see if it matches the number you set in your php.ini file.


You should now be able to upload the file that was causing the error.

And that’s it! These are five steps you can take to get rid of the error message “the uploaded file exceeds the upload_max_filesize directive in php.ini”. Good luck!

Summer Sale VPN