In this article you will learn how to increase WordPress upload limit relating to file size in the media library. If you are new to WordPress, it is very useful tip for you to change upload filesize in the media library. Think of it that you are writing a beautiful post. And it requires to put an image in the post. You are supposed to upload an image through media library. All of a sudden you get an upload error that your file size exceed the maximum file size of upload limit. (i.e. 2MB which is default upload size). This is due to a file on the server named php.ini . this is configuration file for php. In this file different variable of php are set to some default value. So here is required some change in the code in your wordpress installation directory. You don’t need a plugin for this purpose. So let’s start here with this easy step:
Write code in .htaccess file
Locate your file in the root of your wordpress installation folder. If it exists you will edit it. You can use some FTP editor to modify this file online. Or you have to direct access your online web hosting disk through webdisk or FTP. You can download your old .htaccess, update it and upload again. And if the file does not exist then you can create that file in the root directory where is the installation of WordPress exists. Or you can create it on your computer and then upload it to the server. Now open your .htaccess file and write following piece of code at the end of the .htaccess file:
php_value upload_max_filesize 15M php_value post_max_size 15M php_value max_execution_time 300 php_value max_input_time 300
We discuss a little bit about the code given above:
1-php_value upload_max_filesize 15M
It is maximum allowed size for uploaded files.
2-php_value post_max_size 15M
It is Maximum size of POST data that PHP will accept through the uploading process.
3-php_value max_execution_time 300
It is maximum execution time of each script, in seconds on the server.
4-php_value max_input_time 300
It is Maximum amount of time each script may spend parsing request data. It’s a good. It is good idea to limit this time on productions servers in order to eliminate unexpectedly long running scripts. the line above is used to increase the time of execution of the wordpress script time. Here it is set to 300 seconds i.e. 5 minutes, hopefully complete the file transfer in between this time.
Now your limit of maximum file upload size has been change. You can change the file size as you wish. In the above code example file size have been increased upto 15 MB which is enough to upload an image of larger size.
We have learnt that how to write some piece of code in the .htaccess file to increase the maximum file upload size in the wordpress media library form. This will override the default maximum upload file size.