冰雹,我有一个问题,用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
发布于 2010-05-25 20:20:06
您应该设置具有文件大小的标题,以使进度条出现。还应该指定内容类型,对于未知的mime类型使用application/ocet-stream (或强制下载)。
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; https://stackoverflow.com/questions/2908041
复制相似问题