互联网浏览器6 PHP服务文件问题
问题描述:
雹,我有一个问题,用PHP服务文件到客户端。当我想下载它时,保存并打开对话框将会出现,但下载的进度将不会显示。我的问题是什么?互联网浏览器6 PHP服务文件问题
头,我将其发送到客户端:
header('Content-Type: ');
header('Content-Description: File Transfer');
header('Accept-Ranges: bytes');
header('Content-Transfer-Encoding: binary');
保存对话框
HTTP://vzz.ir/files/kn5gsecfnoia1cqkfop6.jpg
进展IP不显示。
HTTP://vzz.ir/files/88ruak7ocjgn10ha9mda.jpg
答
应设置与文件大小的头,使进度条出现。内容类型也应该被指定,使用application/ocet-stream用于未知的MIME类型(或强制下载)。
header('Content-Type: application/ocet-stream');
header('Content-Disposition: attachment; filename=test.dat');
header('Content-Length: '.filesize('test.dat'));
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
readfile('test.dat');
exit;
这两个主题都受影响,但进度问题仍然存在。 :( – sweb 2010-05-25 20:36:04