akshay Posted July 21, 2010 Share Posted July 21, 2010 Hi. $fullPath="/any/path/to/file/file.ext"; $fd = fopen ($fullPath, "r"); if ($fd) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf": header("Content-type: application/pdf"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download header("Content-Length: $fsize;\n"); break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); header("Content-Length: $fsize;\n"); } header("Content-length: $fsize"); header("Cache-control: private; max-age=3600"); //use this to open files directly while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; I've specified max-age with headers. Yet, download is "non-resumable" How can I make it resumable? So that valid for , say 3 days or so? or ever-valid? Please help! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/208426-download-launch-headers/ Share on other sites More sharing options...
premiso Posted July 21, 2010 Share Posted July 21, 2010 Not sure how you would tell it 3 days, but here is a different way to do it: http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file Quote Link to comment https://forums.phpfreaks.com/topic/208426-download-launch-headers/#findComment-1089159 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.