Having trouble with a download in IE

All other browsers working fine. Upload process works fine, even in IE.

Relevant code.


$file = $service->read((int) $_GET['id']);
header("Content-Type: {$file['mime']}");
header("Content-Disposition: attachment; filename=\\"{$file['name']}\\"");
header("Content-length: {$file['size']}");
ob_end_clean();
echo $file['data'];
exit;	

I’m guessing I’m missing a header. The $service object returns an array from the database with the original filename, mimetype, size and data. Data is stored as a BLOB in the database, other fields are text.

Help please.

What’s going wrong? File not downloading? Displaying inline?

If you look at the headers in the other browsers (using Firebug or something similar), do the three headers show up correctly?

Headers show up correctly in all other browers, but IE is rejecting the file download

“Internet Explorer cannot download mod.php from namewitheld.com
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.”

Yeah, not MS’s most useful error message.

Found my solution. The error stems from a bug in how IE handles HTTPS sessions (which this page is served under). The solution is to force PHP not to send a Pragma header with

header("Pragma: ");

More information in this blog post where I finally tracked this down at.

Internet Explorer Can’t Open Files Via HTTPS: Try Removing The Pragma Header - Mark S. Kolich

Again, the problem is specific to HTTPS connections, which I haven’t worked with on downloads before - which in turn explains why I haven’t seen this before.

Argh, that is the singularly most useless message ever.
Once had that one because my HTML contained a self-closed div which was being updated using javascript. Yep, IE crashed because of <div/>.