[thelist] ColdFusion force download of restricted file

jon steele jjsteele22 at yahoo.com
Sun Jun 9 14:15:01 CDT 2002


Hi everyone,

I am currently using the following code to force a download of a file:

<cfset filePath = "c:\path\to\file\thefile.ext">
<cfheader name="Content-Disposition" value="attachment; filename=#getFileFromPath(filePath)#">
<cfcontent file="#filePath#" type="application/octet-stream">

It seems to work, giving the desired result of a "Save File As..." window.

However, if I try this on a folder which is restricted using IIS (i.e. if you were to go to
http://www.domain.com/path/to/file/thefile.ext you would require authentication to access) the
code does nothing. I am wondering if this restriction IS the cause of this problem, because it
seems to work on any other folder. If this is the problem, what should be done to fix it? I
figured since this code uses the real (c:\...) path of the file, the authentication would have no
effect.

Thanks in advance.
Jon

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list