Resuming Downloads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Audiosoft
Forum Newbie
Posts: 2
Joined: Fri Feb 22, 2008 5:35 am

Resuming Downloads

Post 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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Re: Resuming Downloads

Post by anjanesh »

Audiosoft
Forum Newbie
Posts: 2
Joined: Fri Feb 22, 2008 5:35 am

Re: Resuming Downloads

Post 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
Post Reply