1

I use below code to generate download link for my filesm but the generated download links aren't resumable. Also, they aren't showing file size while downloading:

//set_time_limit(0);
header("Pragma: public");
header("Expires: 0"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Cache-Control: private",false);
header("Content-Type: application/download"); 
header("Content-Disposition: filename=file.zip");

$ch = curl_init("http://dl.otherserver.com/file.zip");
curl_exec($ch);
curl_close($ch);        
exit();

How can I solve this problem?

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • 1
    Content-Length header is required if you want the size to show. Resuming requires supporting the Range header. – datasage Jan 16 '13 at 16:33
  • 2
    Possible duplicate: http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file – Csq Jan 16 '13 at 16:33

1 Answers1

1

Because the client doesn't know about the filesize yet. You need to send the Content-Length header.

header('Content-Length: ' . filesize($myFile));

Don't know much about resuming file uploads though.

David Harris
  • 2,697
  • 15
  • 27