Back

How to Increase the Maximum Upload Size in WordPress

A low WordPress maximum upload size in wordpress limit stops you from uploading large files, plugins, and themes. If you’re building a media-heavy website, that can be a considerable obstacle. It’s necessary to increase the max upload size in WordPress or your server (or both) in such cases. In this post, i will show you how to Increase Maximum Upload Size

There are a various approaches to solving this problem, depending on your hosting provider and server. In this article, we’ll use most of them and show you how to quickly increase the maximum upload size in WordPress.

Let’s dive in!

What Is the Maximum Upload Size in WordPress?

Uploading huge files to a server utilizes a significant amount of the server’s resources. The default limit upload size in WordPress normally ranges from 4 MB to 128 MB to protect users from triggering server timeouts. This limit is usually configured at the server level by the hosting provider.

WordPress also has constants that set this limit, but in most cases, they can’t override the server-level settings.

To verify this, go to your WordPress site’s Media Library. Here, try to upload a file that crosses this maximum upload file size limit. You’ll see an error message that looks something like this:

Upload Error in wordpress
Error while uploading a large file in WordPress

Although the error “exceeds the maximum upload size for this site” is frustrating, it exists for two reasons: security and efficiency. It prevents site owners and other users from uploading massive files, including malicious actors (e.g. high-resolution images, large videos, malicious files).

Otherwise, your website’s server may become overwhelmed, causing your site to crawl. Worse, it may completely shut down your website!

How to Check the Current Maximum Upload Size in WordPress

There are several options to check the current maximum upload size for your WordPress site. Let’s go over each one individually.

In the Media Library

The quickest way to check your site’s current maximum upload size is to go to your WordPress dashboard, and from there, go to Media > Library. Here, click on the Add New button to activate the media uploader tool.

The “Maximum upload size limit” in WordPress
The “Maximum upload size limit” in WordPress

You can also go to Media > Add New directly and see the same message displayed at the bottom.

The “Maximum upload file size” in WordPress’ Media Library
The “Maximum upload file size” in WordPress’ Media Library

Ways to Increase the Max Upload File Size in WordPress

Use a WordPress Plugin

First, we like to start we the easiest way because we understand that messing with site code is not for everyone. On WordPress, if you are not comfortable with coding, you can use a plugin instead, WP Maximum Upload File Size should be of help this time.

You can check our post on How to install a plugin if you don’t know how to install WordPress plugins.

We’ll be using the WP Maximum Upload File Size plugin here. As of writing this, it’s the only up-to-date plugin on the WordPress plugin repository that helps you get this done.

Install and activate the WP Maximum Upload File Size plugin to get started. Then, in your WordPress dashboard, navigate to the settings screen for it. The maximum upload file size specified by both your hosting provider and WordPress can be accessed here.

WP Maximum Upload File Size settings screen
WP Maximum Upload File Size settings screen

The maximum upload file size defined by WordPress is smaller than the maximum upload file size set by your hosting provider. As a result, you can turn it up by selecting the Maximum Upload File Size from the dropdown menu.

Note: Using this plugin, you will not be able to set a maximum upload file size limit that is greater than the one set by your hosting provider. You must contact your hosting provider for this.

Update Your ‘.htaccess’ File

If your webserver runs on Apache, you can update your site’s .htaccess file to increase the max upload size in WordPress. You can find your .htaccess file in the WordPress site’s root directory.

As per PHP documentation, three PHP directives are responsible for how WordPress handles uploads. They are:

  • upload_max_filesize
  • post_max_size
  • memory_limit

We’ve already discussed them in the Site Health Info section above. It would help if you modified these three directives’ values to admit your file sizes. For instance, if the largest file you’re planning to upload is 32 MB, we recommend the following settings:

  • upload_max_filesize = 32M
  • post_max_size = 64M
  • memory_limit = 128M

Notice, all the values use M instead of MB. That’s how PHP handles its directives.

Uploads can contain extra information in addition to the file itself. So, giving all other upload-related directives some breathing space is a good idea. You can read our in-depth tutorial on how to improve PHP memory limit in WordPress for more information.

Access your .htaccess file via FTP/SFTP or your hosting provider’s File Manager.

Finding the ‘.htaccess’ file
Finding the ‘.htaccess’ file

Edit the .htaccess file, and then add the following code:

php_value upload_max_filesize 32M
php_value post_max_size 64M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300

You can notice two other PHP directives in the above code: max_execution_time and max_input_time. They define how long a server spends on a single PHP task. The bigger your uploads, the bigger the time spent will be. You need to set their values to a number that’s appropriate for your use case.

Note: You may get a 500 Internal Server Error after using the method above. Most likely, it’s because your server is running PHP in CGI mode. In such cases, you cannot use the above commands in your .htaccess file.

Create or Modify the ‘php.ini’ File

Changes to your default PHP settings are defined in the php.ini file. It usually includes parameters defining file timeouts, maximum upload size, and resource constraints.

You may find the php.ini file in your WordPress root directory using SSH or FTP. You might not be able to find it there in some cases. Don’t be bothered! In the root directory of your site, you can create a new file with the same name.

How to create a new php.ini file
How to create a new php.ini file

Edit your new php.ini file and paste the following code.

upload_max_filesize = 32M
post_max_size = 64M
memory_limit = 128M

After you’ve made your modifications, remember to save your file. Some hosts will not let you change PHP settings this way. If this is the case, you should try the following solution instead.

Create or Modify the ‘.user.ini’ File

If your hosting provider has restricted the global PHP settings, the server may be configured to use user.ini files rather than php.ini files.

The user.ini file, like the php.ini and .htaccess files, is located in the root directory of your website. If you can’t find it, you can create a new.user.ini file in the same directory. To create a new php.ini file, follow the steps outlined in the previous approach.

Next, add the following code to your .user.ini file:

upload_max_filesize = 32M
post_max_size = 64M
memory_limit = 128M

You’ll notice that it’s a repeat of the previous method, except with a different filename.

How to Increase the Maximum Upload Size in PHP Options via cPanel

To get started, go to your cPanel dashboard, and select the Select PHP Version under the Software section.

Click ‘Select PHP Version’ in the cPanel dashboard
Click ‘Select PHP Version’ in the cPanel dashboard

Here, you can change your server’s current PHP version and enable/disable many PHP extensions. Click on the Options link in the navigation menu to go to the PHP Options panel.

Go to the ‘PHP Options’ settings in cPanel
Go to the ‘PHP Options’ settings in cPanel

Scroll down here to modify the values of PHP directives such as upload_max_filesizepost_max_sizememory_limitmax_execution_time, and max_input_time. The max values you can set here depend on your current hosting plan.

The ‘PHP Options’ screen in cPanel
The ‘PHP Options’ screen in cPanel

If you have any doubts about these values, we suggest you contact your hosting provider. The latest cPanel dashboard saves changes automatically, so you don’t have to click anything. But if you’re using an older cPanel version, make sure to click the Save Changes button.

How to Increase the Maximum Upload Size in WordPress Multisite

If you’re running a WordPress Multisite network, then you can modify the max upload file size for your network.

First, head to your Network Admin dashboard, and then go to Settings > Network Settings screen. Here, scroll down till you find the Upload Settings section. You’ll find the Max upload file size the field in this area.

The ‘Max upload file size’ field in ‘Network Settings’
The ‘Max upload file size’ field in ‘Network Settings’

The default value of Max upload file size in a WordPress Multisite is 1500 KB (~1.5 MB). You can change this to a higher value and click the Save Changes button.

Note: From here, you can’t get around the server’s maximum upload size limit. The server will ignore the limit you set here if it is more than the server’s maximum upload size limit. You can check your webserver’s configuration using the methods outlined above.

The new ‘Max upload file size’ in ‘Network Settings’
The new ‘Max upload file size’ in ‘Network Settings’

Here, we’ve set the new max upload file size to 131072 KB (~128 MB).

You can also limit the total size of files uploaded to an individual site in the Multisite network. However, it’s disabled by default.

Disclaimer – WordPress core settings do change from time to time. If this does not achieve its purpose for you at the time using it, please comment below so we can check, assist and update.

Leave A Reply

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

Applications for new entry will be open from April 10, 2023, to May 10, 2023.