Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cfcontent force download

Status
Not open for further replies.

NetworkGhost

IS-IT--Management
Apr 12, 2005
1,324
US
Is there a way using CFcontent to force a download rather than open in window?
 
Code:
<cfset filePath="G:/path/to/domain/file.txt"> 

<cfheader name="Content-Disposition" value="attachment; filename=#getFileFromPath (filePath)#"> 

<cfcontent file="#filePath#" type="application/octet-stream">

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
that's a great post, accurate and error free. however, the user will still be prompted for a "select location to save file to" window

i'm not sure if it's possible for the server to stick a file on a users pc and know where you want it to go... that's like..

<cffm>

some files install with the help of activex or outlook macros and such.

Beware of programmers who carry screwdrivers.
 
There is no way to download a file without the prompt, unless the user's machine is set to not show that.

If there was a way, our machines would be full of spyware and there would be nothing you could do about it. [smile]

Hope this helps

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
well there IS a way... virus' get spread that way but you have to have low security settings and IE. hehe

Beware of programmers who carry screwdrivers.
 
I have firefox set to download my downloads to the same folder, so i don't get the propmt, bu yeah, the prompt is a client issue, not much you can do to get past that legitamitly

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top