mysql - Display pdf from database using php -


there pdf file stored in database [blob - 143.3 kib]. it's got userid of 12. trying call page when click on button, pdf populates webpage.

if (isset($_post["work"]) && !empty($_post["work"]))   {    $result = mysql_query("select file ce userid=12", $c) or die("six");    $document1=mysql_result($result, 0, 'file');     echo $document1;  }   echo '        <form action="yourcase.php" method="post">           <input type="hidden" name="work" value="1">           <input type="image" id="work" src="images/papers.png">        </form>';  

currently, echos out page of this: ‰Œa Â@e÷9Å_ê&&Ói[Ž€°£ zqŠôúÆŽ@ïåÿ&ŠÆÑ,¢y[«*Æx%Ó@/rˆoÝçÇ¡.

using post, able call pdf file desktop, can't figure out how database.

$file = 'sample.pdf'; $filename = 'sample.pdf';  header('content-type: application/pdf'); header('content-disposition: inline; filename="' . $filename . '"'); header('content-transfer-encoding: binary'); header('content-length: ' . filesize($file)); header('accept-ranges: bytes'); @readfile($file);  

thanks @fred, able piece working solution. i've been trying do:

if (isset($_post["work"]) && !empty($_post["work"]))   {     $result = mysql_query("select file ce userid=12", $c) or die("six");    $document1=mysql_result($result, 0, 'file');     header('content-type: application/pdf');    echo $document1;  }   echo '         <form action="fetchdoc.php" method="post">            <input type="hidden" name="work" value="1">                <input type="image" id="work" src="images/papers.png">         </form>';  

look through these links may of help.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -