> I am trying to use cfhttp to get a pdf file and display 
> it in the browser.
> 
> Here's the code I am trying to use
> <cfhttp url = "http://www.somedomain.com/test/file.pdf"; 
> method = "get">
> </cfhttp>
> <cfoutput>
> #cfhttp.header#
> #cfhttp.fileContent#
> </cfoutput>
> 
> I'm new to CF some I'm sure there is something wrong with 
> this code. It gets the file, however, it does not display 
> it properly.

When you use CFHTTP to retrieve a file that isn't just text, like a PDF, you
won't be able to output it directly using CFHTTP.FileContent. Instead,
you'll have to fetch the file with CFHTTP, save it to the filesystem using
the PATH and FILE attributes of CFHTTP, then use CFCONTENT to push the newly
saved file to the browser.

Alternatively, you might consider just redirecting the user's browser to the
PDF, rather than going through all this. It would be more efficient to
redirect the browser using CFLOCATION.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to