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! 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 Link to comment https://forums.phpfreaks.com/topic/208426-download-launch-headers/#findComment-1089159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.