It may be very essential for a user to upload a file in your website. But here the question arises about the maximum uploading limit set in your website. This may be a great problem. You should know that most of the web servers are configured with a maximum limit of 2 mb. Actually, in this present age of high definition files, 2 mb is not a sufficient maximum limit. You should change it before your user faces any problem. But increasing it needs some trick to know. Here we are going to discuss some of these tricks which will help you to increase the uploading limit with an ease.
Below we will discuss on three different methods.
How to Increase Uploading Limit using .htaccess, php.ini and ini_set()
1. Method-1 (Using .htaccess):
First of you will have to create an .htaccess file in the root folder of your web server. Now paste the following code in that file and save it. Here the maximum limit is increased to 20mb but you can do it according to your wish. Just change the figures in the following code in such case.
Now once you are done you will be able to upload up to 20mb file in your website using the file field in your HTML form and move_uploaded_file() function available in PHP. See that the code includes four increased parameters, the first one is maximum file uploading size, the second one is maximum size of the post data, the third one is maximum time in seconds a script is allowed to run before it gets terminated by the parser and the last one is maximum time in seconds a script is allowed to parse input data like file upload, POST and GET data.
2. Method-2 (Using php.ini):
This is the simplest process if anyone can go through it.
At first go to php folder and there find out the php.ini file. Enter the php.ini file and find for variables ‘upload_max_filesize’ and ‘post_max_size or max_post_size’. Now change its default value from 2 mb to 20 mb or the maximum limit you want. After it is done save the php.ini file. Then restart the server. That’s all.
3. Method-3 (Using ini_set()):
This method is also very easy and you will have to just write the following code.