请看下面的截图。当有人从我的网站下载文件,而下载大小没有显示。因此,用户无法知道剩余多少,大小。有人能帮我或者告诉我什么办法来解决这个问题吗?这是服务器的问题吗?或者我要放什么密码什么的?

发布于 2014-05-10 06:03:16
您应该正确地从您的服务器发送标头--请参阅以下内容:- http://php.net/manual/en/function.readfile.php
示例
<?php
$file = 'yourfile.apk';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>https://stackoverflow.com/questions/23577526
复制相似问题