How to increase the upload file size limit in WordPress?

WordPress has a maximum upload size limit. You can increase the maximum upload size by using the following steps:

1. Update .htaccess File

If your web server using PHP and Apache is set as an Apache module, then you can increase the maximum upload size by adding a few lines of code to the .htacccess file.

First, connect to your server via FTP client and go to the folder where WordPress is installed. Next, open the .htaccess file in a code editor or any text editor (like WordPad) and add the below lines:

 

1 php_value upload_max_filesize 64M
2 php_value post_max_size 128M
3 php_value memory_limit 256M
4 php_value max_execution_time 300
5 php_value max_input_time 300

After that, the max upload size will be defined in Megabytes. You can replace the numbers as per your needs. In the above code, the memory limit is set to 256 MB.

2. Edit Functions.php File

Sometimes you won’t be able to access your .htaccess file. So you can adopt an easier method which is by editing WordPress theme files.

To increase the file size limit, include the lines of code given below in the functions.php file of your theme.

 

1 @ini_set( 'upload_max_size' , '64M' );
2 @ini_set( 'post_max_size', '64M');
3 @ini_set( 'max_execution_time', '300' );

 

But, after changing the theme, the max upload size will return to its default values.

3. php.ini Option

php.ini is a default file used for configuring any application that is running on PHP. Inside this file, you will find parameters required for file timeout, upload size, and resource limits. The WordPress root directory can be assessed using SSH or FTP. After accessing the WordPress root directory find the php.ini file. Sometimes, this file won’t be visible and you would need to create a new file instead.

Open a text editor (for example WordPad). Copy the below code and save it as php.ini:

1. upload_max_filesize = 25M
2. post_max_size = 13M
3. memory_limit = 15M

After that, upload the php.ini file using SSH or FTP within the same root folder.

4. Increase Upload Size in Multisite

In the case of WordPress multisite, you can increase the upload size from Settings. Here, the amount of increase depends on your server settings. Let’s take an example - if your server’s WordPress upload size is set to 20MB you won’t be able to increase it to 25MB. But, if your server is set to 20MB and your network setting is set to 15 MB then the issue can be resolved by increasing the upload size to 20MB.

5. wp-config.php File

You can also increase the upload size in WordPress by defining the size parameter in the wp-config.php file. To perform this operation, go to your WordPress root directory using SSH or FTP and find a wp-config.php file.

1 @ini_set( 'upload_max_size' , '20M' );
2 @ini_set( 'post_max_size', '13M');
3 @ini_set( 'memory_limit', '15M' );

 

Open the file in a text editor (for example WordPad) and paste the code given below:

 

 

 

 

Save all the changes. After all these steps your memory limit will be increased.

6. Plugin Method

We also have an easier alternative to all of the above methods. In this method, we will increase the memory limit by using a plugin. We will be using the Increase Max Upload Filesize plugin in our case.

To add the plugin to WordPress, log in to your WordPress Dashboard. Then go to Plugins → Add new, search “Increase Max Upload Filesize”. Then, activate and install the plugin. Next, go to plugin settings and just enter the value for upload size.

Click the Save Changes button. Then the maximum upload file size will be increased.

7. In cPanel

Log into cPanel, and click on the Select PHP version present under Softwares and Services.  
In our example, the PHP version is set to Native 5.4. We cannot change the limit in the default version, so we have to change it to 5.4. If your default version is Native 5.5 then change it to 5.5. 

After you change the version a link will appear saying, " Switch to PHP settings link".
Click on that. Now a page will open where you can change the PHP upload file size limit. Here you can increase the upload file size limit.

Did you find this article useful?