PHP下载恢复支持问题



当我从服务器下载文件时,它不支持恢复。

代码如下:

if ($zc['mm'] && $zc['mm_down'] && preg_match('/.('.$zc['mm_ext'].')$/i', $path, $exts)) {
    $file = $zc['mp3_dir'].'/'.$path;
    if (file_exists($file)) {
        if ($zc['stream_int']) {
            $ext = strtolower($exts[1]);
            zina_set_header('Content-Type: '.$zc['mm_types'][$ext]['mime']);
            $disposition = (isset($zc['mm_types'][$ext]['disposition'])) ? $zc['mm_types'][$ext]['disposition'] : 'attachment';
            zina_set_header('Content-Disposition: '.$disposition.'; filename="'.basename($path).'"');
            zina_set_header('Content-Length: '.filesize($file));
            zina_set_header('Cache-control: public'); #IE seems to need this.
            zina_set_header("Content-Transfer-Encoding: binaryn"); 
            zina_set_header('Content-Type: $contentType');
            zina_send_file($file);
        }
        else {
            zina_goto($path,NULL,NULL,TRUE,TRUE);
        }
    }
}

有没有人可以帮助我如何使这个代码恢复支持。

自己添加简历支持是相当复杂的-您需要检查的Range头不仅支持简单的范围,而且也支持相当复杂的范围。

唯一真正简单和干净的解决方案是使用X-Sendfile头(在Lighttpd的原生支持,模块可用于Apache),它告诉你的web服务器发送某个文件给用户。在这种情况下,恢复、并行下载等都可以正常工作。

相关内容

最新更新