Hi all,
I have read the readfile(), followed examples and I still get garbage when reading the PDF file. Here is what I have so far.
The above code gives me garbage. I am using Firefox and I checked my plugins, aboutlugins, and PDF was listed. I downloaded Live HTTP headers for Firefox and notice that the at the content-Type is still text/html.
What do I need to do in order to view this document?
TIA
Mike
I have read the readfile(), followed examples and I still get garbage when reading the PDF file. Here is what I have so far.
Code:
$filename = "doc6751.pdf";
header("Pragma: public");
header("Expires: 0");
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header( "Content-type: application/pdf" );
header('Content-Length: ' . filesize($filename));
header("Content-Transfer-Encoding: binary");
readfile($filename) or die("Cannot open file");
The above code gives me garbage. I am using Firefox and I checked my plugins, aboutlugins, and PDF was listed. I downloaded Live HTTP headers for Firefox and notice that the at the content-Type is still text/html.
Code:
GET /viewpdf.php?id=6751 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0
HTTP/1.x 200 OK
Date: Tue, 01 May 2007 19:43:51 GMT
Server: Apache/2.0.52 (CentOS)
X-Powered-By: PHP/4.3.9
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
What do I need to do in order to view this document?
TIA
Mike