Note to self: Using CFCONTENT to force file download instead of display
Categories:
Coldfusion
Sometimes I see something useful and I know I'll never remember it, so I'm gonna post it here on my blog.
If you want to force download a document instead of displaying it inline (for example, a jpg image, or a word document (which IE will display inline!)), use the following code in a CFM file:
<cfheader name="Content-disposition" value="attachment;filename=test.jpg">
<cfcontent type="image/jpeg" file="D:\htdocs\filecabinet\test.jpg">
<cfcontent type="image/jpeg" file="D:\htdocs\filecabinet\test.jpg">
Poof! Instant download dialog!
Posted by rickroot at 10:40 AM | Link | 4 comments