help with ie 5.5 download issue

Chuck Hagenbuch chuck@horde.org
Wed, 10 Jan 2001 00:45:49 -0500


Sorry to cross-post, but I need bodies and ideas on this one:

The following php script:

<?php

header('Content-Type: application/x-unknown-image-gif');
header('Content-Disposition: attachment; filename=file.gif');

$fp = fopen('./file.gif', 'r');
fpassthru($fp);

?>

... works just fine for downloading a file, in netscape, and in IE 5.5 if you 
go directly to it.

However, as soon as you follow a _link_ to it (ie, <a 
href="download.php">download</a>, then IE 5.5 chokes and downloads the file 
that had the link in it, instead of the gif.

This is a distillation of the problem with ie 5.5 and attachments that IMP has. 
So, I'm hoping that someone out there either has heard of this and knows a 
workaround, or that someone can be clever and figure out which header(s) we're 
missing, or how to convince IE to treat the new page as if you'd gone directly 
to it (no http_referrer?).

Opening the download in a new window (target="_blank") makes the download work, 
but litters windows over the screen with no good way to clean them up.

-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"If you can't stand the heat, get out of the chicken!" - Baby Blues