Oracle Blob - store and retreive PDF
I google this a lot, but could only find examples for images.
I am having trouble retreiving blob and opening it in the browser as PDF. I get the message "The file is damaged and could not be repaired" message in Adobe Reader. Here is the code.
To store
<cffile action="upload" filefield="form.filename" destination="c:\developer\temp\" nameconflict="overwrite">
<cffile action="readbinary" file="c:\developer\temp\#cffile.serverfile#" variable="file_blob">
<cfquery datasource="oraped">
update ped_ack set ack_blob = <cfqueryparam value="#file_blob#" cfsqltype="cf_sql_blob"> where instfk = 28739
</cfquery>
To retreive
<cfquery datasource="oraped" name="blob">
select ack_blob from ped_ack where instfk = 28739
</cfquery>
<cfheader name="content-length" value="#ArrayLen(blob.ack_body)#" />
<cfheader name="Content-Disposition" value="inline;filename=somename.pdf">
<cfcontent variable="#blob.ack_body#" type="application/pdf">
Your help is appreciated,
kat_dev
