note 32023 added to function.header
| From: | jmertic at ncscredit dot com | Date: | Tue, 13 May 2003 20:03:13 +0000 |
| Subject: | note 32023 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47918@lists.php.net to get a copy of this message | ||
I've been trying to validate PDF Files on Win2k/IIS 5/PHP 4.3.1. Everything worked fine on
Netscape/Mozilla, but IE said it could not find the file. I now use the following method, and all
seems to work well now:
$file = $_GET['uri']; // filename is passed via GET variable
$len = filesize($file);
header("Cache-Control: public");
header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename=" . $_GET['uri'] . "");
header("Accept-Ranges: bytes");
header("Content-Length: $len");
readfile($file);
The "Accept-Ranges: bytes" seemed to be the key to solving this problem.
"Cache-Control: public" was needed in order to use my cookie-based auth scheme.
--
http://www.php.net/manual/en/function.header.php
http://master.php.net/manage/user-notes.php?action=edit+32023
http://master.php.net/manage/user-notes.php?action=delete+32023
http://master.php.net/manage/user-notes.php?action=reject+32023