Forum Moderators: mack

Message Too Old, No Replies

ColdFusion Question

CFHeader / CFContent

         

psusemichel

5:57 pm on Aug 18, 2005 (gmt 0)



I am new to ColdFusion and the following issue has me stumped. I am supporting a site that allows the user to click on a file link and the corresponding application opens and displays the document. However, the name that is displayed is the name of the CF page, not the name of the file. Using CF Help as well as searching on the internet, it appears that the following code should work:

<cfheader name="Content-Disposition" value="inline; filename=#filename#">
<cfcontent type="#cont_type#" file="#file_path#">

For example, for one of the files that is an audio file, I have confirmed that 'filename' = "my_audio.mp3";
'cont_type' = "audio/mpeg"; and 'file_path' contains the full path of the file. The Windows Media Player opens correctly and plays the audio file, but the name that appears is the name of the CF page (i.e. "file_viewer.cfm") This also happens for MS Word, MS Excel, and other documents.

Any suggestions would be appreciated.

Double_Dark

10:01 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



A better place for this question would probably be on the Macromedia Cold Fusion Forums. Webmasterworld doesn't seem to have a lot of CF types running around.

That being said, I do this exact thing in one of our applications.

I generate tab delimited text and put it in file_output Then

<cfheader name="Content-Disposition" value="attachment;filename=""TAB_Batch.txt""">

<cfcontent type="application/ms-excel"><cfoutput>#file_output#</cfoutput><cfabort>