Page 1 of 1

MySQL blob with a PDF display...

Posted: Thu Nov 02, 2006 2:47 pm
by siefkencp
I want to display a PDF that's held in a MySQL blob... Below is my PHP and my MySQL blob Contents Can you tell me if it looks like I stored the file wrong or if my PHP is flawed...

Nothing happens when I go to pick up the file...

Thanks in advance!

--- EDIT!! I truncated the PDF file for readability...

PHP

Code: Select all

<?

include $DOCUMENT_ROOT . '/lib/db_con.php';
mysql_select_db('proof',$mysql_id) or die(mysql_error());


$data = mysql_query("Select pdf,size from proof where proof_id = '$proof_id'") or die(mysql_error());
 $data_array = mysql_fetch_array($data,MYSQL_ASSOC);
 $file = $data_array['pdf'];
 $size = $data_array['size'];
header("Content-type: application/pdf");
header("Content-Length: $size");
echo $file;

 
?>
PDF (what's in the blob)

Code: Select all

%PDF-1.3
%ª«¬­
4 0 obj
<< /Type /Info
/Producer (FOP 0.20.5) >>
endobj
5 0 obj
<< /Length 28607 /Filter [ /ASCII85Decode /FlateDecode ]
 >>
stream
Gb!m/>F/j/OXBq-?bltk+)-^M$hqi7FWMf2QK<#;C6c@nSlS([Z<1*HkG=W8
endstream
endobj
6 0 obj
<</Type /XObject
/Subtype /Image
/Name /Im1
/Length 314
/Width 522
/Height 676
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
Gb"0O3=Prg#QQUZhXCX](3l!C_/5MFzzzzzzz
endstream
endobj
7 0 obj
<</Type /XObject
/Subtype /Image
/Name /Im2
/Length 3491
/Width 168
/Height 74
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
Gb"/,bAeIm$tTEc:^@Co+n3'%LS,1u!`+/d#X3&)%Y
endstream
endobj
8 0 obj
<</Type /XObject
/Subtype /Image
/Name /Im3
/Length 2814
/Width 449
/Height 33
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter [ /ASCII85Decode /FlateDecode ]
>>
stream
Gb"/,MfmN?&.Cfl!"hI!OF]3,"qUfGi/>AgO9&m",&
endstream
endobj
9 0 obj
<< /Type /Page
/Parent 1 0 R
/MediaBox [ 0 0 612 792 ]
/Resources 3 0 R
/Contents 5 0 R
>>
endobj
10 0 obj
<< /Length 5675 /Filter [ /ASCII85Decode /FlateDecode ]
 >>
stream
Gatm@>BAOYQ@AS3cpN"Q;AI
endstream
endobj
11 0 obj
<< /Type /Page
/Parent 1 0 R
/MediaBox [ 0 0 612 792 ]
/Resources 3 0 R
/Contents 10 0 R
>>
endobj
12 0 obj
<< /Length 5412 /Filter [ /ASCII85Decode /FlateDecode ]
 >>
stream
Gau0H=<

Posted: Thu Nov 02, 2006 2:56 pm
by siefkencp
Update-- I can save the blob from MySQL Query Browser (The MySQL GUI app...) and Open the PDF without issue...

Chris

Posted: Thu Nov 02, 2006 4:14 pm
by siefkencp
I Solved it ... -- thanks...