Re: Header Location pointing to a file
| From: | Christophe Deliens | Date: | Tue, 15 Feb 2005 16:49:57 +0000 |
| Subject: | Re: Header Location pointing to a file | ||
| References: | 1 | Groups: | php.windows php.windows |
| Request: | Send a blank email to php-windows+get-25646@lists.php.net to get a copy of this message | ||
Hi,
You can use the header "Content-Disposition: inline", followed by "Content-Type: application/pdf".
Then you can output your PDF file using readfile($pathToPdfFile) or print(file_get_contents($pathToPdfFile))
Hope this helps!
Christophe Deliens -- get2future
Ron Herhuth wrote:
I am writing a script that does a database check and then based on several conditions I need to give the user a PDF file to view in the browser. Normally I would use the header("Location: the_file.pdf") command but this doesn't work...most likely because it doesn't try to resolve the MIME type. Is there a way to load the PDF in the users browser? Thanks, Ron