为什么生成的下载链接不显示文件大小,并且不可恢复


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

我使用下面的代码为我的文件生成下载链接,但生成的下载链接不可恢复。此外,下载时也不显示文件大小:

//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();

我该如何解决这个问题?

因为客户端还不知道文件大小。您需要发送Content-Length报头。

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

我不太了解如何恢复文件上传