Displaying pdf file on a browser
Posted: Mon Oct 28, 2013 6:36 am
Please i'm working on how display pdf file on a browser but each time i try i get this error.
This file can not be display correctly.
Please i your help.
Thanks in advanced
***** Please use PHP Code syntax tag *****
This file can not be display correctly.
Please i your help.
Thanks in advanced
***** Please use PHP Code syntax tag *****
Code: Select all
<?php
mysql_connect("localhost", "root", "") or die ("Could not save image name Error: " . mysql_error());
mysql_select_db("pdf") or die("Could not select database");
$data = mysql_query("SELECT * FROM pdf2 where id='2'") or
die(mysql_error());
while($row = mysql_fetch_assoc( $data ))
{
$src=$row['path'];
$file ='http://localhost/pdf/images/';;
$filename =$src;
header('Content-type: application/vnd.abode.xfdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
}
?>