Forum Moderators: coopster
In my site ,I have to upload files .I can upload files having small size.But now I want to upload files having size up to 50-80 MB.
I am using php5
I changed the php5.ini file as
memory_limit = 300M
upload_max_filesize = 200M
post_max_size = 500M
max_execution_time = 4000
It fails after some time.Error shows as 'Connection Interupted'.
In the specific page (upload.php) also I changed the code as
set_time_limit(0);
ini_set("memory_limit","300M");
ini_set("upload_max_filesize","300M");
ini_set("post_max_size","300M");
ini_set("max_execution_time",3000);
Still the process fails....
Can any one help me...
Thanks&Regards
Kiran
With files of this size it's going to be impossible to determine a "safe" max_execution_time because your users, and even you, will experience time differences in upload as the transfer speed comes and goes.
A possible solution might be to fork() your process. A fork spawns a child process, identified by process id ($pid in example) that runs in the background, something like
if ($pid=fork()) {
// this is the parent process, return "job uploading" to browser immediately
}
else {
// perform time consuming task of upload in this child process
}
You'd have to construct some mechanism to "check" whether the process is "done" and report back to the browser. Once scenario would be in your parent process have a 5 second meta-refresh that calls a function to check if the process $pid is running, if it no longer exists the upload in the child process is complete.