ZIP文件得到由IE损坏 [英] ZIP Files get corrupted by IE

查看:147
本文介绍了ZIP文件得到由IE损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提供使用PHP循环在64K块一个ZIP文件(但将与任何服务器端语言出现的问题)。

I am delivering a ZIP file in 64k chunks using a loop in PHP (but the problem would arise with any server side language).

在获取与FF文件,一切顺利就好了。

When fetching the file with FF, everything goes just fine.

在获取IE7的文件,一些位遭到损坏。这导致对错误的CRC(散)的错误信息和一些解压缩文件的最终会被破坏。

When fetching the file with IE7, some bits get corrupted. This leads to an error message regarding wrong CRC (a hash) and some of the unzipped files end up being corrupted.

正在发送的报头如下:

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

有没有人有一个线索在哪里这个腐败从何而来?

Does anyone have a clue where this corruption comes from?

推荐答案

感谢previous答案,我设法解决这个问题:

Thanks to the previous answers, i managed to solve the problem:

阿帕奇的 mod_deflate模块 EN codeD中的gzip响应。在块发送文件时,这有两方面的影响:

Apache's mod_deflate encoded the responses in gzip. This had two effects when sending the file in chunks:


  1. 的Content-Length 头没有被送出

  2. 使用IE7时交付的文件已损坏

  1. The Content-Length header was not sent out
  2. The delivered files were corrupted when using IE7

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

The solution, in php, is to disable the encoding of the response using the following command:

apache_setenv('no-gzip', '1');

这篇关于ZIP文件得到由IE损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆