I have a small PHP scripts, which serves files. Just a simple download server.
I use the following code:
$mm_type="application/octet-stream";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($path)) );
header('Content-Disposition: attachment; filename="'.basename($path).'"');
header("Content-Transfer-Encoding: binary\n");
readfile($path); // outputs the content of the file
exit();
I stops download the file after 10-15 seconds. When I retry to download the file, it exactly stops at the same filesize. For example the file is 4GB, it stops downloading it at 230MB, when I restart the download, it again exactly stops at 230MB.
What is wrong with the script?