5 Tips to Resolve the Upload_Max_Filesize Error

file exceeds the upload_max_filesize

If you try to upload a massive file to your WordPress website, you might get away with it most of the time. But occasionally, you’ll see the error message “the uploaded file exceeds the upload_max_filesize directive in php.ini” instead. This ridiculously long error message, but we’re going to break it down so you understand what the error means and how to fix it. This way, you can manage your own website like a pro.

Let’s get started!

What is the upload_max_filesize means?

If you’re seeing this error message, then you likely already have web hosting. The first thing you need to know to understand the error “the uploaded file exceeds the upload_max_filesize directive in php.ini” is that web hosts do a lot of behind-the-scenes work to make sure your server never gets overloaded. This includes setting a limit on the size of the files that are uploaded to the server.

The upload_max_filesize directive is the maximum size (stated in megabytes) of a file that you can upload to your server. So, for example, if your upload_max_filesize is 35M, you can’t upload any file bigger than 35 megabytes.

The “php.ini” part of the error message just tells you that the upload_max_filesize directive can be found in your php.ini file.

Putting it together, the error message “the uploaded file exceeds the upload_max_filesize directive in php.ini” means that you’ve just tried to upload a file that’s bigger than the maximum size you’re allowed to upload to your server.
Now that you understand the error message, here’s how you fix it:

5 ways to fix “the upload max filesize error

1. Ask your web host to set a bigger limit

This is the easiest way to solve this problem, but it really only works if you know the ballpark size of most of the files you’ll be uploading. You might be wondering why web hosts set a size limit on your files in the first place. The size limit protects you by helping you make sure you don’t put unnecessary strain on your server by uploading files that are too big.

But just because you increase your limit doesn’t mean you should upload massive files all the time. Large files slow down your website, so it’s good practice to make your files as tiny as you can get them, even if you have a bigger limit.

2. Increase your limit using FTP

(This can only work if your web host lets you access your php.ini file.) To increase your upload_max_filesize directive in php.ini, follow these steps:

1. Connect to your server using an FTP client.
2. Go to your directory and look for the php.ini file.
3. When you find the file, open it up and add this code.

upload_max_filesize = 2M
post_max_size = 3M
memory_limit = 5M
file_uploads = On
max_execution_time = 300

4. Only use this step if you need a suPHP in .htaccess file to run the code.
Add this code to your .htaccess file:

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

Replace “username” in the code with your path. And remember that every web host uses different configurations, so ask your host if these are the right configurations for your server.

3. Increase your limit using cPanel

To increase your maximum file size using cPanel, follow these steps:

1. Open cPanel and find the icon labelled “MultiPHP INI Editor”. (Look under Software.)
2. When the page opens, select your website.
3. Scroll through the settings until you see “upload_max_filesize”.
4. Change the maximum size to whatever you want to be your new maximum file size. Make sure it’s bigger than the size of the biggest file you anticipate needing to upload in the future.

4. Increase your limit using .htaccess

Here’s how you do this:
1. Connect to your website using FTP.
2. Edit the .htaccess file in your root folder by adding this code snippet:

php_value upload_max_filesize 12M
php_value post_max_size 19M
php_value memory_limit 30M
php_value max_execution_time 300
php_value max_input_time 300

(Don’t copy the snippet as is. Change the values to make them work for you.)

5. Increase your limit using WordPress

To do this, follow these steps:

1. Connect to your server’s root directory.
2. Paste this code at the bottom of your wp-config.php file:

define('WP_MEMORY_LIMIT', '270M');

This will change your upload size limit to 270 megabytes, but you can make it bigger if you think you’ll need to upload bigger files.
3.  Go to your WordPress dashboard and go to Media >> Add New. If the maximum upload limit matches the number you set in your php.ini file, you’ll know the changes have successfully been applied.

You should now be able to upload the file that made you see the error message the first time.

Wrapping up

Web hosts set a limit on the maximum size of the files you can upload to your server, but you can easily increase this limit if you need to. But remember that even when you have a bigger size limit, files that are too big will slow down your website. So, as long as you don’t upload massive files every single day, your website should be fine!