How-to-Increase-Upload-Limit-in-WordPress-

How to Increase Upload Limit in WordPress

A common problem you may encounter in WordPress is having trouble uploading large files. You can’t upload a file because it exceeds the maximum upload size. When you face this problem, don’t worry. There are methods you can do to increase upload limit in WordPress.

FYI, this issue isn’t coming from the WordPress, means you can’t resolve it from the WordPress. Instead. The problem is from your server configuration and settings, so you can resolve this by modifying the settings. The limitation itself is there because of security and efficiency reasons. Take a note that the settings will be back to default when you update your theme.

Get Help from Your Host

The first attempt you may try is contacting your host, especially if you’re on a shared host. You can ask them to increase the upload limit which can be done within a minute. It’s a good thing to ask your host first as some hosts don’t allow you to increase the limit by yourself. If your host is unresponsive or doesn’t help you at all, you can try to modify it by yourself. Or it’s time to find another hosting company as a good host will assist you quickly, and get you up and running in no time.

Modify Your Server Settings

The steps that follow mostly require you to access your site via FTP. You will need to use a File Transfer Protocol (FTP) client, one I suggest is Fillezilla (which I also use in the explanation). To connect to your website via FTP, you need to know your FTP connection details.

  • Hostname: normally your website address, but it may also be your server’s IP address.
  • Username: usually the same as your cPanel login information
  • Password: usually the same as your cPanel login information

To ensure those details, you can check the welcome email from your hosting company when you signed up. You will see the detail of your FTP hostname, username, and password there. Fill the information in Fillezilla, enter 21 or 22 in the port box, then click Quickconnect.

increase upload limit - filezilla

You can modify files directly on Filezilla by right-clicking on the file, choose View/Edit (the default will use Notepad to open the folder). Every time you make a change on a file, you will get a notification, simply click Yes.

increase upload limit - filezilla -2

 

Before you start modifying, you have to remember three directives in the PHP settings that matter. They are:

  • post_max_size: the maximum size that is handled in a POST request (to upload large files, this value must be larger than upload_max_size)
  • upload_max_filesize: maximum size for file uploads
  • memory_limit: how much memory is allocated to PHP (this value should be larger than post_max_size).

Now that you know what to modify, you can try different methods to increase upload limit depending on your server setup. You should make a backup of your site and database before start making changes. If there’s any error, you can simply re-upload the original files. After trying whichever of the methods, navigating to Media > Add New to see if the method works.

increase upload limit wordpress

Create or Modify php.ini

To increase upload limit, you may make changes in your server’s php.ini file. This file contains the PHP’s configuration details where you can change the values you saw on your PHP info page. Due to restrictions in servers, you may not be able to see the php.ini file in your directory. This mostly happens when you’re on a shared host.

To find the php.ini file, FTP into your site and from the root directory, navigate to the folder where your WordPress install is in (usually in an ‘html’, ‘www’, or ‘public_html’). Search for php.ini file, then click View/Edit option to modify the three settings that matter. In this example, we will increase upload limit to 64 MB. Search and change the value of memory_limit, upload_max_filesize, and post_max_size to 64M. You may also modify max_execution_time value (in this example is 300) in order to make sure that your site doesn’t timeout when uploading large files. Save after you’re done editing. It may take a little while to see the effect of those changes.

memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Note: It’s not recommended to go higher than 128 MB.

If you can’t find the file in your directory or your host doesn’t give you access, you may create a new file to override the default settings. Create a new file in Notepad or TextEdit (the format should be plain text), then paste the following code and name the file as php.ini

memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
file_uploads = On
max_execution_time = 300

Upload the file to your site root where the WordPress files are. If you are on PHP 5, you may also try to name it php5.ini.

 

Modify .htaccess

You can try this method if creating/editing the php.ini didn’t work. .htaccess file contains various settings which can be used to modify the server behavior. Take a look at your root directory, then View/Edit the file named .htaccess. At the bottom before </IfModule>, paste the following code, then save it.

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

If there’s a problem with the memory limit, you can also add this on the code:

php_value memory_limit 64M

 

increase upload limit - htaccess

Modify Theme Function Files

This is another trick you can try to increase upload limit in WordPress. In this method, you are required to edit the WordPress files directly. Navigate to your active theme folder in through the ‘html’, ‘www’, or ‘public_html’ folder > wp-content, then find for functions.php file. Open the file then at the very top paste the following code.

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

Most server/hosting company keeps ini_set function disabled, which can’t allow you to try this method. If you need to modify the memory limit first, you can go to the root directory and find wp-config.php file. View/Edit the file then paste the following code at towards the bottom.

define('WP_MEMORY_LIMIT', '64M');

Increase Upload Limit in WordPress Multisite

If you’re running a multisite installation, you can modify the upload limit Network Admin > Settings > Network Settings > Upload Settings > Max upload file size (you’ll see the max upload file size option on the bottom of the page). Change the limit size to your liking in KB, then click Save. Bear in mind that you can’t exceed the server limit. For example, if the server is set to limit of 10 MB then you set the limit in network settings 20,000 KB or 20MB, it won’t work. But if the server limit is 20MB and the limit on network settings is below, you can still increase the limit on the settings up to 20,000 KB.

 

 

Did you manage to increase upload limit in WordPress with one of the methods below? Have you faced any troubles when trying those methods? Don’t hesitate to share your experience 🙂

  • Comments ( 0 )

  • Leave a Reply

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

TOP