Sending files to MS Internet Explorer with https

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wangster
Forum Newbie
Posts: 1
Joined: Wed Aug 14, 2002 3:48 pm
Location: Winnipeg Canada

Sending files to MS Internet Explorer with https

Post by wangster »

I have seen code examples to send files to IE and they work great as long as the connection is not encrypted, but as soon as we switch to https, IE goes back to throwing the same errors.

Here is the code. If anyone has a clue how to get this to work over https with IE please let me know. A major project we are working on relies on MS being able to make a browser that works.


<?php
// sendfile.php
$file="word.doc";
header("Cache-control: private"); // work around for IE
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($file));
header("Content-Disposition: attachment; filename=".$file);

$fp = fopen($file, 'r');
fpassthru($fp);
fclose($fp);
?>

The error message in IE is "Internet Explorer can not download 'sendfile.php?rev=1'" from mydomain.com. Internet Explorer was not able to open this internet site... bla bla bla..."

This is the same error you get in IE if you try the above code without the header("Cache-control: private"); so obviously something about the encryption is causing IE problems.

work arounds anyone?
Post Reply