Internet Explorer Corrupts my Zip FIle when downloading...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
ro
Forum Newbie
Posts: 7
Joined: Thu Aug 21, 2003 7:57 pm
Location: Bentonville, AR

Internet Explorer Corrupts my Zip FIle when downloading...

Post by ro »

OK, I'm at my wits' ends with this problem. I have a download page that sends the correct
headers to the browser and downloads a blob file from a MySQL table. Everything works
great on Mozilla, Netscape, and IE until I try to download a Zip file. What's puzzling is that
the SAME EXACT file works in Mozilla/Netscape but DOES NOT work on IE. Tha is, IE
somehow manages to corrupt the file when it moves it from the temp directory,
rendering the downloaded file obsolete and useless. Here is the code for the headers
I send:

Code: Select all

<?php
  Header ("Pragma: public");
  Header ('Expires: '.gmdate("D, d M Y H:i:s \G\M\T", time() + 3600));
  Header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  Header ("Cache-Control: no-store, max-age=0, no-cache, must-revalidate"); # HTTP/1.1
  Header ("Cache-Control: post-check=0, pre-check=0", false);
  Header ("Cache-control: private");
  Header ("Content-Type: $datatype" );
  Header ("Content-Length: " . $FileObj->size );
  Header ("Content-Disposition: attachment; filename="$filename"");
?>
So any suggestions would be GREATLY appreciated!
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

I don't see anything obvious with the headers, can you show me how you actually output the file?
User avatar
ro
Forum Newbie
Posts: 7
Joined: Thu Aug 21, 2003 7:57 pm
Location: Bentonville, AR

Post by ro »

I actually figured out the problem... at the top of my script I had:

ob_start("fatal_error_handler");

Well that Custom Error Handler I wrote actually resent the buffer with
the "ob_gzhandler" module and therefore was screwing up the ALREADY
compressed data. Actually, I don't think it was screwing up the data it
was just compressing it again, Mozilla/Netscape handled it WELL... but
OF COURSE MICROSHAFT Internet Explorer did not!

Thanks anyway and I hope this helps someone as well.
Post Reply