How to Increase Maximum File Upload Size WordPress

WordPress CMS supports a large number of hooks using plugins, themes, etc. But when it limits you to perform some function due to file size of the plugin, plugin files like backups, themes or video, etc. In that case, you’ve to increase the file upload size limit.

Increase the File Upload Size Limit WordPress

In this tutorial article, we’ll understand how we can increase the file upload size limit using function.php, .htaccess, php.ini, nginx.conf (nginx).

Increase Maximum file upload size in WordPress

You can increase the upload size limit of your WordPress application using various methods, that allows you to upload large files in your website.

Using Theme Function file function.php

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

You can add the following lines in the function.php file to increase the file size. In the above command, the maximum file size is 64MB, you can change this value to increase the limit, for example, 512M for 512MB, 1G for 1GB.

using php.ini method

You can increase file upload size, maximum post size, memory limit using php.ini in Apache or NGINX. php.ini can be located in the root directory of the application.

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 512M

Find the above command and replace it according to your need, like search upload_max_filesize and change the values like 512M, 1G, etc.

Using .htaccess increase upload size limt

You can edit the .htaccess root file of your website and paste the following code into it. This file is supported by the Apache webserver. This feature is not available in the nginx server.

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

Paste the above values in the .htaccess file to increase upload size limit. Change the values as per your needs.

In NGINX server block.

If the file size limit increased using php.ini or function.php method and your nginx server stoping the upload then you can add the following code in the nginx server block.

By default nginx file size limit is 1MB, you can increase this value by adding client_max_body_size in the nginx.conf file.

For all server block, you can add the code into http block of nginx.conf

http {
    client_max_body_size 100M;

Increase limit for a set of app/web, change values in the server block.

server {
    client_max_body_size 100M;

Increase limit for perticular directory location.

location /uploads {
    client_max_body_size 100M;

After the changing the above setting you can restart or reload the nginx to load the new configurations.

I hope you liked the above article, in case of any doubt, feel free to ask in the comment section below.

Ashok Kumar

Ashok Kumar working in the Search Engine Optimization field since 2015. And worked on many successful projects since then. He shares the real-life experience of best SEO practices with his followers on seoneurons.com. You also can learn Advance level SEO for WordPress, Blogger, or any other blogging platform. Stay tuned.

Related Articles

Leave a Reply

Back to top button