Skip to main content
Inspiring
May 6, 2013
Question

Downloading file not the correct contents

  • May 6, 2013
  • 1 reply
  • 357 views

Hi,

I have a link on another page the take me over to the page that contains the code below:

<CFOUTPUT>
<CFSET FPATH = #GetDirectoryFromPath(ExpandPath("*.*"))#>

<cfdirectory directory="#FPATH#" name="FILES" action="LIST">

<TABLE>
<CFLOOP Query="FILES">
<TR><TD>
<CFIF #FILES.NAME# EQ "test.cfm">

 
<A href="#FILES.NAME#"> #FILES.NAME# 

<cfheader name="Content-Disposition" value="attachment;filename=#FILES.NAME#">


</A>
</CFIF>
</TD>
</TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>

When I select the test.cfm link, a dialog box appears asking to either Save or Open the file.

The issue is the file, test.cfm, contents is not what is being saved or displayed when Open is selected.

Is there something I'm missing?

Thanks,

Mike

    This topic has been closed for replies.

    1 reply

    userCold9Author
    Inspiring
    May 6, 2013

    I am trying to download a text file, not a cfm file.

    Mike