Forum Moderators: coopster
All works correctly but it seems to be particularly slow on files that are over 30Mb. A file of 5Mb has the save dialogue displayed in a second or or quicker but for a file of 60Mb it seems to take up to 10seconds, which is not very good for the user.
Do you know of anything within the readfile() function that could cause this?
If the objective (and quite rightly so) is to improve the user experience, regardless of whether or not it actually makes any difference overall, you might want to try a combination of fread() [uk.php.net],flush() [uk.php.net] and fpassthru() [uk.php.net]
Something like:
$fp = fopen("/path/to/file","r");echo(fread($fp,2048)); // get the first 2K out the door that should trigger the browser's download prompt
flush();
fpassthru($fp);
fclose($fp);
exit();
That's off the top of my head so I can't confirm that this will provoke the download dialogue but it may help...!
By the way, how would the buffering affect this?
Thanks...