我正在使用下面的代码,我改编了:http://ee.php.net/manual/en/function.fread.php#84115到我的代码允许下载恢复,它在Firefox上工作得很好但是不起作用完全用铬.如果我尝试使用chrome,文件正在下载,我暂停,等待几分钟,但是当我恢复它时,下载立即完成,文件已损坏.
知道为什么吗?
function dl_file_resumable($file, $is_resume=TRUE)
{
//First, see if the file exists
if (!is_file($file))
{
die("<b>404 File not found!</b>");
}
//Gather relevent info about file
$size = filesize($file);
$fileinfo = pathinfo($file);
//workaround for IE filename bug with multiple periods / multiple dots in filename
//that adds square brackets to filename - eg. setup.abc.exe becomes setup[1].abc.exe
$filename = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ?
preg_replace('/\./', '%2e', $fileinfo['basename'], substr_count($fileinfo['basename'], '.') - 1) :
$fileinfo['basename'];
$file_extension = strtolower($path_info['extension']);
$ctype='application/octet-stream';
//check if http_range …Run Code Online (Sandbox Code Playgroud)