ZIP文件被IE损坏

Pie*_*ing 3 php apache zip internet-explorer download

我使用PHP循环以64k块提供ZIP文件(但任何服务器端语言都会出现问题).

使用FF获取文件时,一切都很顺利.

使用IE7获取文件时,某些位会被破坏.这导致关于错误CRC(散列)的错误消息,并且一些解压缩的文件最终被破坏.

要发送的标头如下:

Expires: 0
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: public
Content-Description: File Transfer
Content-Disposition: attachment; filename="671fb8f80f5e94984c59e61c3c91bb70.zip";
Content-Transfer-Encoding: binary
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/octet-stream
Run Code Online (Sandbox Code Playgroud)

有没有人知道这种腐败来自哪里?

Pie*_*ing 6

感谢以前的答案,我设法解决了这个问题:

Apache的mod_deflate以gzip编码响应.以块的形式发送文件时有两种效果:

  1. Content-Length标题是送不出去
  2. 使用IE7时,传递的文件已损坏

在php中,解决方案是使用以下命令禁用响应的编码:

apache_setenv('no-gzip', '1');
Run Code Online (Sandbox Code Playgroud)