How To Fix Upload Max Filesize WordPress Error?

You have probably seen upload max filesize WordPress error (upload_max_filesize) at least once while operating your WordPress website. If you didn’t, believe me, you will sooner or later.

This notification usually appears when you try to upload WordPress theme or plugin. An error has nothing to do with the theme or plugin you are uploading. The issue is with your hosting server settings which limits the maximum size of uploaded files.

It’s a common error and it can be easily fixed. This error message is an indication that the file you are trying to upload is larger than your web host allows (WordPress default file upload size is 2 MB).

By default, WordPress has a modest limit for uploading images, videos, and other files. It’s a similar case with PHP memory limit too which helps you run plugins and scripts.

When trying to upload files which are larger in size, you may encounter a message like this: “The uploaded file exceeds the upload_max_filesize directive in php.ini.”

This error message is quite self-explanatory. You’re trying to upload files that are bigger in size than what is specified within the PHP.ini config file.

Depending on your web hosting company you will have maximum file upload limit. For some, it is 2 MB which is not enough for media files like audio or video and most plugins and themes.

You can quickly check your WordPress upload file limit by going WordPress Admin Dashboard -> Media -> Add New section.

 

wordpress maximum upload file size 2mb

 

As some plugins can go more than 20 MB in size and themes can be more than 50 MB, it is evident why some want to increase max upload size when uploading through WordPress dashboard.

But I highly recommend that you use cPanel or FTP solution like FileZilla for uploading themes and plugins which are big in file size.

 

How To Fix upload_max_filesize WordPress Error?

To increase upload file limit, you will need to change file upload size settings for your WordPress website. You can do it yourself or ask your web host support team to increase the file size limit for you.

Ways to fix uploaded file exceeds the upload_max_filesize WordPress message:

  1. Updating php.ini file
  2. Editing .htaccess file
  3. Editing wp-config.php
  4. Changing maximum upload size in cPanel
  5. Edit theme functions.php
  6. Contact hosting support

 

1. Updating php.ini file

Each server has a php.ini file. Typically it can be found in the wp-admin folder. You need to edit that file and write your new memory limit.

By default, php.ini files are the ones that govern how your server is set up. Due to restrictions in servers, you may not be able to use php.ini files.

If you host your websites on a VPS or dedicated server, you will have the access. But if you host your websites on a shared hosting, you will most likely not have the option to edit php.ini file.

If you use cPanel, go to the Files section and click on the File Manager button. Make sure the checkbox for Show Hidden Files is checked and then click Go.

 

exceeds the maximum upload size for this site wordpress

increase file upload size wordpress

 

Select your wp-admin folder and find a file called php.ini or php5.ini (usually locate on /etc/php.ini).

If you don’t see it, create one by clicking the New File button in the top left-hand corner. Name the file php.ini and select the Create File button on the pop-up. If you follow these instructions and it still doesn’t work, try renaming the file to php5.ini.

If the file was already there, search for the three settings and modify them if necessary. If you just created the file, or the settings are nowhere to be found, you can paste the code below.

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

The M means megabytes. Change the value limit to the value with which you feel most comfortable. In many cases, the values you enter should get larger as you go down the list from lines one to three.

The upload_max_filesize should be the smallest while memory_limit should be the largest. The median should be post_max_size.

Note that you can even change values to much higher like 256M or more (though, I don’t recommend that high). Save the changes you made to the php.ini file. Now refresh your website and try uploading the file again.

 

2. Editing .htaccess file

If the editing of PHP.ini file didn’t work, then you can edit your site .htaccess file to fix this issue. The .htaccess file is a special hidden file that contains various settings you can use to modify the server behavior.

This is the easier way to fix the problem and mostly used if your website is hosted on a shared hosting. The steps are same. Log in to your web hosting account and go to cPanel. Click on FILES -> File Manager. Go to Document Root for your site and be sure the checkbox for Show Hidden Files is checked.

 

wordpress file upload limit

 

Then find the .httaccess file. Open the .htaccess file and add the following code at the bottom (or edit if it is already there).

php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M

 

Change the values to limits that best suit your needs. Save the changes you made to the .htaccess file.

NOTE: If you can’t find the .htaccess file in your root directory, create a file and name it .htaccess.

 

3. Editing wp-config.php 

If neither of these solutions works for you, you can try editing the wp-config.php file located at your websites root folder.

Add the following to the very bottom of wp-config.php (just before the “happy blogging” line):

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

 

4. Changing maximum upload size in cPanel

If your hosting provider is using cPanel (see cPanel pros and cons) and allows changing PHP settings, you can easily increase maximum file upload size. Access cPanel and look for Select PHP version (see how to update WordPress PHP version) in the Software section.

 

wordpress upload_max_filesize

 

Click on Change to PHP options.

 

wordpress upload limit

 

Modify the post_max_size and upload_max_filesize values.

 

wordpress max file upload size

 

Click on Save button to save the changes.

 

5. Edit theme functions.php

You can also try to increase your website upload limit by editing your theme functions.php.

Open the file functions.php located on your current WordPress Theme (/wp-content/themes/…). Add below code into the file:

@ini_set( ‘upload_max_size’ , ‘128M’ );
@ini_set( ‘post_max_size’, ‘128M’);
@ini_set( ‘max_execution_time’, ‘600’ );

 

6. Contact Web Host Support

If none of these solutions worked for you, contact your web host support. Your web host may have configured their server in a way that prevents you from increasing file size.

 

Increasing Upload Max Filesize in WHM

If your site is hosted on a VPS or dedicated server, you can try changing the upload and memory limits in your WHM. Once you have logged in, go to Server Configuration > Tweak Settings > PHP.

Increasing upload_max_filesize in WHM

 

Enter in the numbers that work for you and click Save at the bottom of the page. Next, go to Service Configuration > PHP Configuration Editor. Scroll down until you find the core sections memory_limit and upload_max_filesize

 

Increasing upload_max_filesize in htaccess

 

Enter the correct values for your setup. Click Save at the bottom of the page.

 

Increase upload_max_filesize WordPress Final Words

WordPress comes with its own media uploader. It makes uploading files to a blog an easy task. There is no need to deal with FTP clients or File Managers. All media files you want to have on your blog can be easily uploaded by clicking just a few buttons.

However, media uploader uses PHP to upload files to the server and, unfortunately, there is an upload limit for maximum file size. Also, sometimes you want to upload plugins or theme to your WordPress site which have significant file size.

This limit can be different depending on hosting provider or your WordPress configuration. In most cases, maximum file upload limit is more than enough for regular WordPress user.

Trying to upload larger files will cause this file exceeds the maximum upload size for this site error. This limit exists for security and efficiency’s sake. It prevents users from flooding your site with huge file uploads and knocking your server to its knees.

If you need to upload large files only once, you could upload your files via FTP or cPanel. I hope one of the mentioned methods help you increase your WordPress website upload file size. If you have any questions or have a better method, let me know in comments below.


DISCLOSURE: Posts may contain affiliate links. If you buy something through one of those links, I might get a small commission, without any extra cost to you. Read more about it here.

2 thoughts on “How To Fix Upload Max Filesize WordPress Error?”

  1. I’m trying to reconcile my WP dashboard telling me there’s a performance issue because these settings don’t match, and the CPanel description for post_max_size, which states “…To upload large files, this value must be larger than upload_max_filesize. …”. Just wondering who has the better standing for their reasoning.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top