Passing files to a browser
| From: | Rob Root | Date: | Thu, 08 Feb 2001 17:43:21 +0000 |
| Subject: | Passing files to a browser | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38784@lists.php.net to get a copy of this message | ||
HI,
I am having problems passing files through to a browser. First I tried:
<?php
$fp = fopen("test.pdf", "r");
header("content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?>
And got an Acrobat instance with no file displayed. Then I tried:
<?php
$fp = fopen("test.txt", "r");
header("content-type: text/plain");
fpassthru($fp);
fclose($fp);
?>
And got:
Hello, World
<br>
<b>Warning</b>: 1 is not a valid File-Handle resource in
<b>/home/robr/public_html/php/getpdf.php</b> on line <b>5</b><br>
Help!!
rr