Siyamak Shahpasand
Siyamak Shahpasand

Reputation: 303

php - why generated download link doesn't show file size and isn't resumable?

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?

Upvotes: 1

Views: 364

Answers (1)

David Harris
David Harris

Reputation: 2707

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.

Upvotes: 1

Related Questions