How to Change Max Upload Size in WordPress?

How to change max upload size in WordPress - CodeFlist

Have you faced an error related to the uploading size limit when you are trying to upload themes, plugins, or any files having large sizes?

If not, you are lucky not to be a part of it. But, saying this doesn’t mean that you may not face this issue in the future. So, in this post, we will discuss how to change max upload size in WordPress.

Why increase max upload file size in WordPress?

When a limit is applicable on your site, you may not be able to upload media files having a higher size than the current limit. The high-resolution images, videos, and audios usually have a high size so you require a greater limit to be able to upload them.

If you try to upload a file size greater than the limit on your dashboard, you will receive the error as shown below:

Maximum File Size Upload Error
Maximum File Size Upload Error

You may also face this issue while uploading a theme or plugin if its size is large.

If you have a website that you operate for selling digital files, in such a case you need to upload files with high size than your maximum limit available. If so, you should know how to change max upload size in WordPress.

How to check max upload size in WordPress?

If you upload a larger file size, the server requires more resources. In order to prevent this, the server sets this limit for their manageable amount. Saying this you have to remember that the maximum upload size limit is different from one hosting server to another.

You may not be able to upload huge file sizes in WordPress with the limit but it also prevents malicious users to upload huge file scripts on your site.

Generally, there are two locations where you can find the max upload size in WordPress.

Media Library

Once you are logged in to the dashboard, Go to Media >Add New. You will see the maximum upload file size in the window. It differs according to the hosting provider. Have a look at the maximum file size that can be uploaded to your site.

Maximum Upload File Size
Maximum Upload File Size

This confirms that our maximum upload file size limit is 40 MB.

Site Health

You can also check the maximum upload file size limit from Site Health. If you haven’t used Site Health yet, this is a tool updated by WordPress after version 5.2 to check the details of the server and WordPress. It is a good practice to check Site Health at regular intervals as it shows the noticeable issues and data that a website is linked with.

You can check the maximum upload file size limit when you open Tools > Site Health > Info > Media Handling

Site Health - Media Handling
Site Health – Media Handling

Apart from this, you will also find other media-related information from Media Handling.

If you want to double-check the maximum upload file size limit from Site Health, Just Go to Site Health > Info > Server

Site Health - Server
Site Health – Server

This option gives you multiple information about your server while you can also cross-check the maximum file size limit of your site here like in the window below.

How to change max upload size in WordPress?

If there is a need to upload a file size larger than the current uploading limit then you should know how to change max upload size in WordPress. There are different ways to increase this limit. Let’s discuss these methods in detail:

Contact Hosting Provider

Since the server handles the request for maximum upload size limit, it can be increased or decreased by the host themselves. If you do not want to get involved in coding or changing settings in WordPress, it’s as simple as contacting your hosting provider.

Most of the hosting providers like HostGator, Bluehost, etc. will provide this technical support to your account. So, this is the first method one should try before they try to change on their own. Unfortunately, if your host did not provide this support to you then don’t worry there are many other ways to increase max upload size in WordPress which we will discuss below.

Use a Plugin

If the above method did not work for you, and if you are still not interested in writing codes then search the plugin that increases max upload size in WordPress.

Have a look at these plugins that does the same task for you.

  1. Big File Uploads
  2. Increase Maximum Upload File Size
  3. WP Increase Upload Filesize

Install and activate one of these plugins. Follow the respective plugin instructions to learn how to change max upload size in WordPress with the use of plugins.

How to change max upload size in WordPress Multisite?

If you have the multisite, it can be easily done with the following steps:

First of All, go to the Network Settings on the site.

How to change max upload size in WordPress Multisite
How to change max upload size in WordPress Multisite

You will find the option to change the maximum upload file size as shown in the picture above. Enter the required size needed for you and apply the changes.

Functions.php file

First, you need to locate the functions.php file present on your theme. The easiest way to find this file is from the WordPress dashboard. When you are on the dashboard, Go to Appearance>Theme Editor Check the functions.php file of the active theme.

You can also access the functions.php file from cPanel, FTP. Go to the wp-content/themes folder and find the functions.php file of the theme.

After locating the functions.php file from any of the above methods, edit the file and place the following code:

@ini_set( 'upload_max_size' , '150M' );
@ini_set( 'post_max_size', '150M');
@ini_set( 'max_execution_time', '350' );

While keeping the code adjust this number according to the requirement of your file size.

How to increase max upload size in WordPress using functions.php file
How to increase max upload size in WordPress using functions.php file

When you update the theme, this setting will be lost. So, you need to add this code again after an update. So, it is recommended to use a child theme if you do not want to lose these changes.

In the functions.php file, you can also add a filter upload_size_limit to carry on the same operation.

You need to add this code at the end of the file:

function filter_site_upload_size_limit( $size ) { 
   return 1024 * 1024 * 100; 
} 
add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 150 );
Using upload_size_limit filter in functions.php file
Using upload_size_limit filter in functions.php file

.htaccess file

.htaccess is the hidden file in the root directory of your site by default. You need to enable the settings to display hidden files if it is not displaying. Once you locate the file, you can edit the file and place the following code at the bottom of the file after the line #END WordPress

php_value upload_max_filesize 150M
php_value post_max_size 150M
php_value memory_limit 250M
php_value max_execution_time 300
php_value max_input_time 300

If you do not find .htaccess file even after enabling hidden files, you can create one. Make sure the name of the file is .htaccess and paste the default attributes of .htaccess and above-written code below the line #END WordPress

wp-config.php

First of all, find and locate the wp-config.php file in the root directory where WordPress is installed. Find this file in the root directory for the domain or in the sub-domain folder for the sub-domain. At the end of the file add these lines:

@ini_set( 'upload_max_size' , '80M' );
@ini_set( 'post_max_size', '120M');
@ini_set( 'memory_limit', '120M' );

Make sure to edit the number as your need.

Php.ini File

You cannot access this file directly from the dashboard by default. Access this file in the root directory from cPanel or FTP credentials. Edit the file and keep the following code at the end of the file:

upload_max_filesize = 80M
post_max_size = 120M
memory_limit = 120M

Keep the file size to suit your need. Sometimes if the file is not present in the root directory create a file with the name php.ini and copy the above code to this file.

Wrapping Up

Are you clear on how to change max upload size in WordPress? Which method did you prefer among the above-listed methods? If you found this post useful, consider reading our other articles posted on the blog.

Our Other Posts:

  1. How to highlight text in WordPress
  2. How to schedule post on WordPress
  3. How to find WordPress username and password in cPanel