【问题标题】:internet explorer 6 php serve file probleminternet explorer 6 php 服务文件问题
【发布时间】:2011-02-23 21:10:17
【问题描述】:

冰雹,我在使用 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

【问题讨论】:

    标签: php download header internet-explorer-6


    【解决方案1】:

    您应该使用文件大小设置标题以显示进度条。还应指定内容类型,对未知的 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; 
    

    【讨论】:

    • 两个主题都受到影响,但进度问题仍然存在。 :(
    猜你喜欢
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多