France,

What a first name! When I would do an HTTP call (using the getAsBinary 
attribute set to true) to get a PDF document I did the following to prompt the 
user to download. I noticed some differences though in how I uses cfcontent and 
I actually outputted the binary data (returned to the client). I'm not sure it 
will help but I just wanted to let you know the code I used to see if it solves 
your problem. Try it out, I updated the code to use your variable.

<cfcontent type="application/pdf" reset="yes">

<cfheader name="Content-Disposition" value="attachment; 
filename=testDocument.pdf">

<cfoutput>#toString(getDocument.documentSource)#</cfoutput>
<cfabort>



Javier Julio
Web Developer, Arc90
www.javier-julio.com

> Subject: Re: Display PDF binary data in a browser without using a tempFile
> From: [EMAIL PROTECTED]
> To: [email protected]
> Date: Wed, 2 Jan 2008 15:43:56 -0500
> 
> 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:3222
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