Page 1 of 1

Resuming Downloads

Posted: Fri Feb 22, 2008 5:50 am
by Audiosoft
Hello

The location of downloadable files on our website is hidden from the users. When they click a button to download a file a PHP script finds the file and starts the download. Our users would like to use download managers in order to resume a interrupted download. However when testing our site with download managers they show resume as not possible.

The code that does the download is

Code: Select all

 
// set headers
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: $mtype");
header("Content-Disposition: attachment; filename=\"$asfname\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . $fsize);
 
// download
@readfile($file_path);
 
Are there any additional headers that need to be sent to the server to allow a download to be resumed or is a different technique required to allow downloads to be resumed?

Thanks
Ian

Re: Resuming Downloads

Posted: Fri Feb 22, 2008 6:15 am
by anjanesh

Re: Resuming Downloads

Posted: Fri Feb 22, 2008 6:38 am
by Audiosoft
anjanesh

Thanks for the hint. I can see how you could use Content-Range to split a large download into smaller bits, but as PHP script only runs on page load, the script would not be able to reponse to a resume request from the download manager.

Ian