我创建了一个简单的下载脚本,可以在桌面浏览器上运行完美。然而,当尝试在Android上下载ZIP或WAV文件时,它似乎只显示和下载文件的36%..这是一个已知错误还是我在这里做了一些完全错误的事情?
我的功能在检查后触发:
function forceDownload($file_to_download,$header){
header($_SERVER['SERVER_PROTOCOL'].' 200 OK');
header("Content-Type: ".$header);
header("Content-Transfer-Encoding: Binary");
header('Cache-Control: must-revalidate');
header("Pragma: public");
header("Content-Length: ".filesize($file_to_download));
header("Content-Disposition: attachment;
filename=\"".basename($file_to_download)."\"");
ob_end_flush();
@readfile($file_to_download);
exit();
}