I wrote the section below to insert PDF files directly into my database. For
some reason it sometimes works and sometimes it doesn't. I've noticed the
files are OK when they're uploaded to the server (and they're viewable) but
when I save them from the database they've been truncated and corrupted. Adobe
suggests converting the binaries to base64... As a test I converted file_blob
into base64, saved it into the database and retrieved it but it was still
truncated and corrupted.
>From what I see that would point to the 2nd cffile as the culprit - has anyone
>else seen this before?
<cffile
action="upload"
filefield="FORM.upload#idx#"
destination="#Application.tempdir#"
accept="application/pdf"
nameconflict="overwrite" />
<cffile
action="readbinary"
file="#Application.tempdir#\#file.ServerFile#"
variable="file_blob" />
<cfquery name="insNewJEAttachment" datasource="#Application.dsn#">
insert into t_je_attachments (
id_je
,timestamp
,filename
,fileActual
)
values (
#jeid#
,#currentTimeODBC#
,'#file.ServerFile#'
,<cfqueryparam value="#file_blob#" cfsqltype="cf_sql_blob" />
)
</cfquery>
tia,
- Joe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322954
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4