Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can I use ColdFusion to serve files that exist outside of the web root?

Use the <cfcontent> tag. You can set the file attribute to point to a file on any local or mapped path on the system on which the web server runs. You also need to set the type attribute (A file or MIME content type, optionally including character encoding, in which to return the page).

<cfcontent file="C:\files\example.jpg" type="image/jpeg">

See also:

http://www.coldfusioncookbook.com/entry/39/How-do-I-force-a-file-to-download-instead-of-displaying-inline-in-IE,-Firefox-and-other-browsers?


This question was written by Jeremy Petersen.
It was last updated on December 3, 2007 at 6:39:02 PM EST.

CFML Referenced

<cfcontent>

Categories

File and Directory Access

Comments

There are no comments for this entry.