So I am writing a download script that hides file URL with header force download,
header("Content-type: application/octet-stream\n");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0\n");
header("Content-Transfer-Encoding: binary\n");
$filesize = filesize($filelocation);
header("Content-Length: ".$filesize);
header("Content-disposition: attachment; filename=\"$name$ext\"\n");
readfile("$filelocation");
exit;
All works fine, except for if a file is too large, then it seems to be a PHP memory issue, like the script is running while the file is downloading, and if the file takes too long to download the script runs out of memory... and the download halts,
Here is what was suggested to me, but I am not even sure where to begin to do something like this...
Write a PHP script which will re-initiate the transfer of the file and maintain the HTTP session. This way if the whole file cannot be downloaded the script will clear the buffer and transfer the next part of the file to your client's computer.
anyone have any ideas?
thanks!