Hi Friends, Today in this article I am going to explain how can we upload big files in PHP via htaccess, Actually basically we can upload files via PHP having 2 MB in size but when file exceeded 2 MB size then it is not uploading files to server or in local because by default file size to be uploaded is set to 2 MB and when we try to upload big file or large file than in size than 2 MB then it is giving error and not uploading files, So to enable uploading large files in Size we have to make some configuration on server or local. We can increase this limit by two files on server, one is https.conf and second is .htaccess
When we work on localhost then we are having access to httpd.conf file, So from that file we can increase limit of uploading files, but when working on server mostly we dont have access to https.conf file, So we have to change or increase file size by htaccess file. So it is not difficult to increase file size by htaccess , you just have to add one line with increased file size in MB and your problem will solve. So below is htaccess rules by which you can use to upload a large file using file field of the form and copy() OR move_uploaded_file() function in PHP.
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value max_execution_time 360
php_value max_input_time 360
So by above rules you can uplaod files of 32 MB and below are explanation of other rules :
Rule 1: upload_max_filesize sets maximum file size for uploading.
Rule 2: post_max_size sets maximum size of the post data.
Rule 3: max_execution_time sets maximum time in seconds a script is allowed to run before it is terminated.
Rule 4: max_input_time sets maximum time in seconds a script is allowed to parse input data of HTML form.
So by this way we can increase uploading file size limit by htaccess. Alternatively, file upload services are available for many uses.