Firefox fails to detect content type set by PHP
Posted
by Ying
on Stack Overflow
See other posts from Stack Overflow
or by Ying
Published on 2010-04-09T23:02:23Z
Indexed on
2010/04/09
23:13 UTC
Read the original article
Hit count: 351
Hi all, I want a php page to 'display' a pdf. Here is the code:
<?php
header("Content-type: application/pdf");
readfile('Reportage - Berlin.pdf'); //tried echo(readfile(...)) as well
?>
Not very complicated I think, but somehow firefox cant detect that this is a pdf. This works in Safari but in firefox, i get a prompt to download the file, so i get like a pdftest.php file. I know im getting my file because if I rename the extension to pdf, i can open it.
This seems too simple! am i missing something?
© Stack Overflow or respective owner