Archie,
> <cffile action="READBINARY" > file="#InPdfFullname#" > variable="binPdf"> >From here, convert to base64() <cfset tempvar = tobase64(binPdf)> Then insert as a blob > > <cfquery name="updateTransfer" datasource="xxxxxxx"> > UPDATE fmTransfer > SET TranDataBinary = (<cfqueryparam value="#tempvar#" cfsqltype="CF_SQL_BLOB">) > WHERE TranFormId = 'AAA158AC' > </cfquery> HTH Michael > -----Original Message----- > From: Archie Campbell [mailto:[EMAIL PROTECTED] > Sent: Monday, December 04, 2006 7:03 PM > To: CF-Newbie > Subject: Re: HowTo store a PDF or JPEG file in a MS SQL 2005 database > > Bob Imperial wrote: > > Hi Archie, > > > > This is just me, but I don't store images or pdfs in a db, I generally > > upload both and store only image or pdf names in the db. Storing them in > a > > db would produce a rather bloated db after a short while ;) Then I'll > > reference the directory I store them in using a variable name somewhere > > above my query, ie; > > <cfset imgDir="C:\wwwroot\mysite\images" /> then use the "imgDir" in my > > output, same with the pdf files. Not sure if this is what you were after > but > > it works for me ;) HTH > > > > Yes, thanks for the thought Bob. > In addition to wanting to figure out how to get a PDF into a SQL data > field, I am also looking for alternatives. > > In this case the PDFs are small, around 25k, so it seems OK to keep them > in the database > > > > Bob > > > > -----Original Message----- > > From: Archie Campbell [mailto:[EMAIL PROTECTED] > > Sent: Monday, December 04, 2006 7:34 PM > > To: CF-Newbie > > Subject: HowTo store a PDF or JPEG file in a MS SQL 2005 database > > > > I have PDF files and possibly some JPEG files that I want to store in a > MS > > SQL Server 2005 database. > > I was thinking I would use a VarBinary(MAX) field. > > > > Is this a good way to do it? > > > > I ask this because I got > > "ByteArray objects cannot be converted to strings" > > for the line > > SET TranDataBinary = '#binPdf#' > > in the following test code > > > > <cffile action="READBINARY" > > file="#InPdfFullname#" > > variable="binPdf"> > > > > <cfquery name="updateTransfer" datasource="xxxxxxx"> > > UPDATE fmTransfer > > SET TranDataBinary = '#binPdf#' > > WHERE TranFormId = 'AAA158AC' > > </cfquery> > > > > Thanks > > Archie Campbell > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2300 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
