How to upload large files in PHP
Posted by jhalak on May 15, 2008
Problem: File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini)
Solution:
1) To update the php.ini file set
upload_max_filesize = 20M (your desired size)
post_max_size = 20M (your desired size)
max_execution_time = 3000 (your desired time)
2) Add the following lines in the .htaccess file in the root directory of the server:
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
3) In the php file including the following codes:
<?php ini_set(“memory_limit”,”64M”); ?>
<?php ini_set(“post_max_size”,”20M”); ?>
<?php ini_set(“upload_max_filesize”,”20M”); ?>
In HTML file from where the file will be uploaded:
<form ……………………….>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”200000000″>
<input type=”file” …………………>
</form>
The choice depends upon the situation.
Jason said
thanks, very helpful, much apprciated.
joe said
ok good