Posted by shawn on 10/23/05 20:02
Hi
I have a pdf that I am serving outside the web root. What puzzles me is that
IE only lets me save the document. After I save it I can open the document
with no problem. When I choose "Open" from IE's popup dialog, it launches
Adobe Reader and the Adobe Reader returns error:
"There was an error opening this document. The file cannot be found".
Here are all the headers and variables:
<?
$filename="the_absolute_path_to_the_pdf_doc_on_server";
$type="pdf";
$public_name="WhitePaper.pdf";
$size = filesize ($filename);
header("Accept-Ranges: bytes");
header('Content-type: application/'.$type);
header('Content-Transfer-Encoding: Binary');
header('Content-Disposition: attachment; filename= '.$public_name);
header('Content-Length: '.$size);
readfile($filename);
?>
Is there anything I didn't right? Why can I save but not open? Please help.
Thanks!
Shawn
Navigation:
[Reply to this message]
|