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.

Categories

File and Directory Access

Comments

comments powered by Disqus