There are two considerable factors for upload any file. These are
1. Execution time
3. File Size.
Your script must need to execute until the file is uploaded completely. And offcourse your server alow your expected upload file size. Php have default configuration for both issue. Execution time is set by default 60 seconds. And allowed maximum file size is up to 2MB. Now what shall you do for a audio or video file. Your internet connection might slow and need more execution time then default. Again you may need more file size to be allowed then 2MB. The question is how??
To increase your execution time write a single line of code at the beginning of your script. here it is:
set_time_limit(0);
?>
Now the big issue. Have to increase maximum file size as you need. One solution like:
ini_set("upload_max_filesize",30);
?>
For view current maximum allowed size (before and after change) use echo like:
echo ini_get("upload_max_filesize");
?>
Now the most critical one. Though almost all server allow set_time_limit(0) but Most of the server doesn't allow ini_set("upload_max_filesize",30). I find one more alternatives. You can edit the maximum size by using .htaccess. Means create a file named .htaccess write the following code in that file. Now upload it at the same path where your source file is. Now run your script and test with echo ini_get("upload_max_filesize");
.htaccess file code:
php_value upload_max_filesize "25M"
Enjoy your coding....... If you get any more solution please let me know. I am most novice one so i don't know much but like to learn.
php_value upload_max_filesize "25M"
Enjoy your coding....... If you get any more solution please let me know. I am most novice one so i don't know much but like to learn.
No comments:
Post a Comment