WordPress

Easy Ways to Change the WordPress Upload Limit

In this post, we discuss the main methods to increase the WordPress upload limit - a problem that many users face when trying to add files to their websites.

thumbnail

While creating a website, you can face the problem of the limited file size uploads in WordPress. We know how frustrating this can be when you wish to add a specific file without sacrificing quality.

This post focuses on various ways to change the maximum upload size in WordPress. No matter whether you are in favor of coding or need a coding-free method, we have a suitable solution. Read the article and change your WordPress upload limit easily.

What Is the Maximum Upload Size in WordPress?

The maximum upload size differs for WordPress users. It may depend not only on WordPress itself but also on your server. Usually, hosting providers set a limit to prevent users from uploading large files.

Normally, the WordPress upload limit is from 4MB to 128MB.

Why Increase the Maximum Upload File Size in WordPress?

You may need to increase the maximum upload file size for various reasons. Let’s look at the most common ones.

Keeping Your Website Up-to-date

Regular updates are the key to success for many websites, particularly, blogs. Adding media is an essential part of such updates. Thus, file limits, especially very low ones, can frustrate you when you can’t include a desired video or image of good quality.

Installing New Themes or Plugins

Sometimes, if you want to change your WordPress theme or install a new plugin via the WordPress admin dashboard, these elements can exceed the maximum upload file size. So, to get the desired look or functionality, you should change the limit.

Creating a Digital eCommerce Store

If you wish to create a website selling digital files of various kinds (e.g., videos, books, pictures, etc.), you’ll definitely need to increase the limit of file uploads. Digital goods can be hundreds of megabytes and even more.

Publishing an Online Portfolio

Similar to online stores, portfolios usually feature the best works of a person, and these files can also exceed the set limit. If you don’t want to choose what to present in your portfolio just by file size, you’ll need to increase the upload file size.

Adding Media as Website’s Background

It’s possible to set a video or a high-resolution image as a site’s background. Such files can be pretty big, so you have to make sure that you increase the limits to be able to add quality media to your site.

Whatever the case is, if you need to upload a big file and get an alert informing you that it’s impossible, you need to increase the maximum upload file size.

How to Check Your Maximum File Upload Size Limit in WordPress?

You can check your current maximum file upload size in several ways.

1. In the Media Library

The easiest and fastest way to check file sizes is to try to upload a large file to your WordPress Media Library. To do this, you should

  • find ‘Media’ on your dashboard and choose this menu item
  • click the ‘Add New’ button (or try dragging and dropping files to the specialized area)
  • check the message below the file upload field.

If your file exceeds the limit, the upload will fail, and you’ll see the “Maximum upload file size” in the message.

In the screenshot below you can see that the maximum upload file size is currently 50MB.

2. In the Site Health Info

Starting with WordPress 5.2, you can see detailed information about your WordPress website configuration on the site health info screen. It is here that you’ll find technical information about your permissions, including file sizes.

To open Site Health info, it is necessary to press on ‘Tools’ on your dashboard, select ‘Site Health’, and go to the ‘Info’ tab.

Afterward, you can scroll to the Media Handling dropdown and check the maximum size of an uploaded file.

Additionally, you can check the information in the Server dropdown. If your server settings limit your maximum upload file size, you’ll see it.

How to Change Maximum Upload Size in WordPress

Now, let’s speak about various ways of increasing the maximum upload file size.

1. Modify Theme Functions File

WordPress themes include a template called functions.php or the theme functions file. When you install a theme, it gets activated automatically. You can edit this file by modifying its PHP code to change the default features on your website.

To increase the upload size, you can add the following code to your functions.php file:

@ini_set( 'upload_max_size' , '128M' );
@ini_set( 'post_max_size', '128M');
@ini_set( 'max_execution_time', '300' );

2. Create or Edit an Existing PHP.INI File

If you have access to your WordPress root folder, you can try this method. With the help of the FTP or File Manager app in your cPanel dashboard, you can change or create the php.ini file. This file includes your default PHP settings. So, open your WordPress root directory and look for the php.ini file. If there is one, open it. If your folder doesn’t contain this file, you can easily create it.

Then, with the help of any text or code editor, add the following code to the php.inin file:

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

Remember to save the changes in the file. Sometimes this method will not work if your hosting provider doesn’t let you change PHP settings.

3. Change the .htaccess File

Another way to increase the WordPress upload limit is the .htaccess method. It is suitable for those whose servers run on Apache. To change the upload file size, you have to update the .htaccess file located in the WordPress website’s root folder.

Open the file manager of your cPanel and find the .htaccess file. Afterward, right-click on the file, choose ‘View/Edit and add the code below to the file:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300

Save the changes in the file and make sure you upload it back to the server.

If your server is running PHP in CGI mode, you won’t be able to add the directives to the .htaccess file. In this case, you’ll get a 500 Internal Server Error, and you should try another method.

4. Contact Your Hosting Provider for Help

Most hosting providers offer technical support, and helping you to increase your upload file size is an easy undertaking for them. Hence, reaching out to your hosting company is one of the easiest ways to change file upload limits.

You can usually get support via emails, chat, or phone. Contact the company, explain what you need, and ask them to modify the necessary settings for you (if this is possible in your hosting plan).

5. Increase the Max Upload File Size in WordPress Multisite

In case you have several websites running as a network in WordPress Multisite, you can change the upload file size for all sites in the network simultaneously. To do this, open the Network Admin dashboard and choose Network Settings in the Settings section. The latter contains the ‘Max upload file size’ field. Simply increase the value (which is in Kilobytes) and save the changes.

Note that editing settings via this method will not override the server’s limits. In other words, if the server upload file size is smaller than the one you set in the WordPress Multisite, the server will not follow the WordPress settings.

6. Create or Modify the ‘.user.ini’ File

If you can’t change your php.ini files because your hosting provider doesn’t allow you to change the global PHP settings, you can try configuring the .user.ini file.

Similar to php.ini and .htaccess files, the .user.ini file is located in the website’s root folder. If it is not there, you can create it yourself. Then, add the code below to the .user.ini file:

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

As you can see, this method is the same as changing the php.ini file, and you just have a different file name.

7. Change PHP Options via cPanel

Another WordPress increase upload size method is to use your server’s cPanel dashboard. If you can configure your server in this way, you’ll be able to adjust upload limits.

When you log in and open the cPanel dashboard, choose ‘Software’ and ‘Select PHP Version’ in it. Then, you’ll see a page with the PHP extensions where you should switch to the PHP options. You should find the upload_max_filesize option and choose the desired file size in the dropdown menu. Remember to check post_max_size and memory_limit, too.

In the newest cPanel versions, there’s no need to click the ‘Save’ button, as all the changes are saved automatically. Yet, if you have an older version and do see such a button, remember to save the settings.

8. Increase the Max Upload File Size in Nginx

For WordPress websites running on Nginx servers, you have to edit both the php.ini and nginx.conf files to change WordPress max file upload size. Follow the steps below to adjust the settings.

1) Modify the php.ini file. It is usually located in the /etc/php/7.4/fpm/ folder. Open the php.ini and add this code:

upload_max_filesize = 64M
post_max_size = 128M

Remember to save the changes in the php.ini file.

2) Enable the applied configuration by restarting PHP-FPM. To do this, run the following code in your terminal:

sudo service php7.4-fpm restart

3) Add the directive which sets the upload size limin to the nginx.conf file. Use this address to find the file: /etc/nginx/nginx.conf. After opening the nginx.conf file, add the directive below:

client_max_body_size 128M

It’s possible to declare the directive in various blocks: 

  • the http {…} block
  • the server {…} block
  • the location {…} block.

You should note that if you add the directive to the http block, you’ll modify the settings for all the sites/apps hosted on your server. If you only want to modify a particular site/block hosted by the server, you should define the directive in the server block. Additionally, you can use the location block to change a specific directory inside the website or app.

Remember to save the changes and restart Nginx by running the command below in your terminal:

sudo service nginx reload

Sometimes, providers restrict access the Nginx configuration file. Then, you’ll have to contact the support team so that they can adjust the settings for you.

9. Use the WordPress ‘upload_size_limit’ Filter

WordPress includes the upload_size_limit filter that regulates the maximum upload size for the php.ini file. If you want to edit this filter, you need to find your theme’s functions.php file.

After you log in to your WordPress website, open the Theme Editor in Appearance on the left side of the dashboard. You’ll open the functions.php file where you need to add the following code:

function filter_site_upload_size_limit( $size ) { 
   return 1024 * 1024 * 64; 
} 
add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 128 );

As you can see, the last line of this code sets the maximum upload file size of 128MB. You may choose another value and change the code if necessary. Afterward, remember to press the “Update File” button to save the changes.

10. Use a WordPress Plugin

If you don’t want to deal with coding and changing root files manually, you can install a WordPress plugin developed for these purposes. Let’s consider several plugins that will assist you in modifying upload limits hassle-free.

1) WP Increase Upload Filesize by CodePopular is compatible with WordPress 4.0 and newer versions. After installing and activating the plugin, you can find it on the main dashboard of your WordPress website. When you click on the settings, you’ll see the upload limit set by your hosting provider. If this limit is bigger than your WordPress maximum upload size, you can increase the latter. Use the dropdown menu to apply the necessary settings.

2) Increase Maximum Upload File Size by Imagify is another plugin suitable for changing the upload file size. It works with WordPress 3.0 and newer. 

When you have installed and activated this plugin, you should go to Settings on your dashboard and click on the ‘Increase Maximum Upload File Size’. The plugin automatically identifies the limits set by your hosting provider and WordPress. Thus, you can increase the WordPress limit so that it doesn’t exceed the server limit.

3) WP Upload Size by Husain Ahmed can also be used to change the limit for uploading files. It’s compatible with WordPress 3.7 or newer.

After the plugin’s installation and activation, you’ll find it in the Tools section of your dashboard. To increase the limit for WordPress files, you have to enter a numeric value in bytes. Remember to save the changes.

Unlike the plugins described previously, the WP Upload Size doesn’t show you the limit set by the hosting provider.

11. Upload Files via FTP/SFTP

Besides uploading files with WordPress Media Library, you can also upload them via FTP or SFTP. If the methods described above didn’t work for you, uploading files with FTP/SFTP will solve the problem of a limited file size.

FTP, or File Transfer Protocole, lets you add files from your local computer to your website’s server. Follow these steps:

  • Open your FTP client
  • Find the folder for uploads (usually, it’s wp-content/uploads/… and a year/month)
  • Open the folder on your PC with local files that you wish to upload
  • Drag and drop the files from the computer to the server.

It may happen that WordPress doesn’t recognize the files that you added via FTP/SFTP. Then, you can take advantage of the free Add from Server plugin. It is suitable for WordPress 5.4 and newer. After installing and activating the plugin, you’ll see the ‘Add from Server’ section under the Media menu on your dashboard. You should choose the folder to which you have imported the files via the FTP client. Then, select the files and press ‘Import’. Then, you’ll be able to see these files in your Media Library.

Verify Your WordPress Site’s New Max Upload File Size

Whatever method you have chosen to change the file upload limit, it’s better to check that it has worked. The easiest way to ensure this is to go to the Media Library and check the maximum upload file size there.

In addition, you can go to the Site Health Info page and check the data under Media Handling and Server dropdowns.

To conclude, the variety of methods to increase the WordPress upload limit is vast. If you are ok with coding, you can edit php.ini, .htaccess, and .user.ini files or change the limit with the WordPress filter. If you prefer to keep away from coding, install plugins and change the limit in several clicks. Even when these methods don’t work, you can always upload files directly to the server with an FTP client.


World-Class WordPress Development Services from GetDevDone

Having trouble increasing the WordPress upload limit or performing another task to make your website fast and functional? Our WordPress developers will help. With 16+ years of industry experience and thousands of successfully completed WP projects, we know everything about the world’s most popular CMS.

Contact us with any WordPress-related task, from developing custom themes to improving your website’s Core Web Vitals scores. Helping your business succeed is our top priority!

Dmytro Mashchenko

Dmytro is the CEO of GetDevDone, an experienced web developer, and a prolific author of in-depth technology and business-related posts. He is always eager to share his years-long expertise with everyone who wants to succeed in the web development field.