You are here: Serving PDF document outside www root problem. « All PHP « IT news, forums, messages
Serving PDF document outside www root problem.

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация