Corrupted ZIP files (downloaded via a php script) : Internext Explorer 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a set of files stored in a directory and I need to serve those via a
php script (in order to protect, control access etc).

The problem is that zip files (exe also) get corrupted when I try from IE7.
 I've read the posts from this list and google etc with no idea of how to
solve it.

The stored files are ok (tested from firefox or direct copy).  When I use
IE7 the file size is smaller.  In my test a config.zip with 248 bytes ends
up with 214 bytes.

This is the code used

header("Pragma: public");
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: ".$type);

if($remove_date_from_file == false)
    header('Content-Disposition: attachment;
filename="'.basename($file).'"');
 else
  {
         $name_ = substr(basename($file),0,strrpos(basename($file),"."));
         $ext_ = substr(basename($file),strrpos(basename($file),"."));
         $new_name_ = substr($name_,0,strlen($name_)-15).$ext_;
         header('Content-Disposition: attachment;
filename="'.$new_name_.'"');
 }
 header("Content-Transfer-Encoding: binary");
 header('Content-Length: '.filesize($file));
 while(!feof($fp))
 {
     echo fgets($fp) ;
 }
 fclose($fp);

I've added a debug to send me a message with the header and it comes the
same way no matter what browser.


Pragma: public

Expires: Wed, 16 Jul 2008 23:12:00 GMT

Cache-Control: must-revalidate, post-check=0, pre-check=0

Cache-Control: private

Content-Type: application/zip

Content-Disposition: attachment; filename="config.zip"

Content-Transfer-Encoding: binary

Content-Length: 248

Am I doing something wrong or do I have to start looking to the server's
configuration (like mod_deflate)?

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux