Hello Friends,

I have seen many developers who find difficulties when working with larger files upload in php. When files which are too large in size, needs to be uploaded by php than you have to change the default file size either from php.ini OR httpd.conf OR using .htaccess. Default upload file size will be 2MB. If you are uploading file which is larger than 2MB size than here i am showing you the way to upload larger files using PHP.


As i told there are three ways to do this task which are below.
    1) .htaccess
    2) php.ini
    3) httpd.conf

When you are working in localhost than you may change and increase the upload file size limit using any of the above. But the best way is to do with .htaccess as when your site will be on server than you may not have access of php.ini and httpd.conf. You can make .htaccess file , write the below rules and you will get the solution to increase the upload file size.

Below is the rules of htaccess using 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

That's it. Now you can upload the file with size up-to 32MB.

In the above .htaccess rules,uploading capability is increased by above rules which are explained below.

    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.

You can set the value of these parameters as per your file size.
You can also set these values from php.ini or httpd.conf file by searching these name and increase the size limit as per your needs.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.

Enter your email address:
 
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.
rax rss Upload large(Big) files in PHP using .htaccess   rax twitter Upload large(Big) files in PHP using .htaccess   rax facebook Upload large(Big) files in PHP using .htaccess

Related posts:

  1. Redirect one domain to another using .htaccess
  2. How to Upload Files to a WordPress Post/Page
  3. How to set PHP configuration(php.ini) values from .htaccess file
  4. 301 Redirect old dynamic URLs to new static URLs using .htaccess
  5. How to restrict users from accessing files & directory level(Protect directory) using .htaccess

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.

Enter your email address:
 
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.