0
<?php
mysql_connect('localhost','root','');
mysql_select_db('pdf');
require('fpdf.php');
if(isset($_POST['submit'])){
\t $name = $_POST['name'];
\t $email = $_POST['email'];
\t $comment = $_POST['comment'];
\t $url = $_POST['url'];
$pdf=new FPDF();
$pdf->AddPage();
$pdf->Image('logo.png',18,13,33);
$pdf->SetFont('Arial','B',14);
$pdf->Cell(50,10, $name,1,1);
$pdf->Cell(50,10, $email,1,7);
$pdf->Cell(50,10, $url,1,1);
$pdf->Cell(50,10, $comment,1,1);
$pdf->SetFont('Arial','B',7);
$pdf->SetFont('Arial','B',6);
$pdf_name=$pdf->Output("","S");
if(isset($_POST['submit'])){
\t mysql_query("INSERT INTO pdf VALUES('','".mysql_real_escape_string($pdf_name)."')");
\t echo "insert successful!";
}
}
?>
<?php
mysql_connect('localhost','root','');
mysql_select_db('pdf');
$query=mysql_query("SELECT * FROM pdf WHERE id='11'");
$row=mysql_fetch_assoc($query);
$content = $row['pdf_file'];
header('Content-Type: application/pdf');
header("Content-Length: ".strlen(content));
print $content;
?>
這是我顯示PDF文件保存爲BLOB,但返回錯誤它不能顯示該文件的一部分。