note 27614 added to function.fpassthru
| From: | ssharma at remove_me dot odc dot net | Date: | Fri, 13 Dec 2002 00:01:47 +0000 |
| Subject: | note 27614 added to function.fpassthru | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40826@lists.php.net to get a copy of this message | ||
I was having a hard time getting IE to download stuff through an ssl (https) link. I finally found
a bug report that said you need to clear out the Pragma and Cache-Control headers or else it
won't send. Here's the important part of my download script.
$contentType='application/octet-stream';
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: $contentType");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-length:".(string)(filesize($fullfilepath)));
$fd=fopen($fullfilepath,'r');
fpassthru($fd);
This works perfectly over http and https in both Mozilla and IE6. Obviously $filename just has the
name of the file and $fullfilepath has the complete file system path to the file.
--
http://www.php.net/manual/en/function.fpassthru.php
http://master.php.net/manage/user-notes.php?action=edit+27614
http://master.php.net/manage/user-notes.php?action=delete+27614
http://master.php.net/manage/user-notes.php?action=reject+27614