Does anyone have an answer for this?  I am trying, for the first time today, to 
insert a pdf file into a SQL Server 2005 database (in a column of 
varbinary(max) datatype), and then query the database and display it back into 
the browser.  

I have the file uploading with the following code:

<cffile action="READBINARY" file="#form.uploadFile#" variable="binPDF">
<cfset tempvar = tobase64(binPDF)>
        
<cfquery name="uploadToDatabase" datasource="francine">
INSERT INTO [dbo].[Documents]
([documentType]
,[documentExtension]
,[documentCreatedById]
,[documentVersion]
,[documentSource])
VALUES (#form.documentType#,
'pdf',  
#form.documentCreatedById#,
#form.documentVersion#,
cast('#tempvar#' as varbinary(max)))
</cfquery>      

My insert is going into the database, but I am unable to pull the file and view 
it via a cfml page.  

Here is the code for my viewDocument page:

<cfquery name="getDocument" datasource="testDB">
select top 1 *
from dbo.Documents
order by documentId desc
</cfquery>

<cfcontent type="application/pdf" variable="#getDocument.documentSource#">

When I run the page, I get binary data displayed.  Any help is appreciated!!

Thanks,
France




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3221
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to