Every site you own may have a preset File upload size limit. This depends on the hosting company and the package you select. Sometimes, this file upload size limit can be as low as 2MB which is enough for uploading media files like images.

But, what if you wish to upload a file that exceeds your file upload size limit?

In this article we’ll see three methods that can help increase this limit for your website.

  1. Through the Theme Functions File
  2. Through the PHP.INI file
  3. Using the htaccess method

Theme Functions File

This method works in a few cases. You simply need to add the following code in the theme functions file.

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

In this example, we’ve increased the maximum upload size limit to 64MB. You can keep it to anything that will suit your needs.

Creating or editing the PHP.INI file

The PHP.INI file is often found in the root directory. In case you are using a shared host, you may not be able to see a PHP.INI file in your directory. If you do not find this file, create one and paste it in the root folder. You can then add the following code into the file.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Here too, we have considered 64MB as a rough figure. You can set it to any amount that’s suitable.

htaccess method

This also is a tried and tested method where users have tried creating or editing the .htaccess file in the root folder by adding the following code to 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

Note: In case none of these methods work for you, this means that you are on a shared host environment and need appropriate permissions from the web hosting provider to do so. You can therefore, contact your web hosting provider and request him to increase the file upload size limit for you.