RE: forcing downloads
There is no way to force a download in HTTP. You can only imply the suggestion of a download by setting the type to application/octet-stream in your cfcontent tag. Although myself and a few others have had some good success (off list) using hidden frames, and some cunningness. All - I dont think we're ready to release it yet, but mail me off list if you'd like a look see. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: forcing downloads
thanks Jochem, seems to be closer. weirdly though it doesn't work the first time I run the cfm file, it only returns the correct response when I try a second time. Any ideas on why that is / how to correct ? ta. .jez Cold Fusion wrote: What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). There is no way to force a download in HTTP. You can only imply the suggestion of a download by setting the type to application/octet-stream in your cfcontent tag. We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) To get the right filename add a cfheader: cfheader name=Content-Disposition value=attachment; filename=#chr(34)#fname.ext#chr(34)# Jochem ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: forcing downloads
Thomas Chiverton wrote: There is no way to force a download in HTTP. You can only imply the suggestion of a download by setting the type to application/octet-stream in your cfcontent tag. Although myself and a few others have had some good success (off list) using hidden frames, and some cunningness. Based on what mechanism? AFAIK the closest thing that is in the HTTP spec would be what is described in RFC 2616 19.5.1, which is the application/octet-stream solution I provided. I presume there are other methods that work with certain browsers, but how would you know for sure it works with future browsers unless you base it on the HTP spec? Jochem ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: forcing downloads
Cold Fusion wrote: thanks Jochem, seems to be closer. weirdly though it doesn't work the first time I run the cfm file, it only returns the correct response when I try a second time. Any ideas on why that is / how to correct ? Can you reproduce this with different browsers and if so, with which browsers? Jochem ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: forcing downloads
Based on what mechanism? the great Kludge :-) for sure it works with future browsers unless you base it on the HTP spec? I don't - but we can filter them out and deal with them seperetly. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: forcing downloads
Try this. Link --- a href=dload.cfm/#file#?filename=#file# target=_new#name#/a Dload.cfm -- cfcontent file=#request.docstoreroot#\#url.filename# deletefile=No type=unknown That's the official work around from about 2 years ago, probably still works. -Original Message- From: Cold Fusion [mailto:[EMAIL PROTECTED]] Sent: 26 July 2001 18:00 To: CF-Talk Subject: forcing downloads Hi folks.. can anyone help us out with this one, it should be so simple and I just can't accept all the hassle we've been having to try and figure it out. What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) surely this is a simple operation? ... I really hope somebody can make me look stoopid with the answer.. in hope .jez Jeremy Becker ([EMAIL PROTECTED]) 100 High Street Wandsworth London SW18 4LA United Kingdom Tel: 020 8871 4240 Fax:020 8871 4584 http://www.bta.com Network Consultancy and Support for Windows 9x/NT and MacOS. Internet connectivity, solutions, and business services. This message is intended only for the use of the person(s) (The intended recipient(s)) to whom it is addressed. It may contain information which is privileged and confidential within the meaning of applicable law. If you are not the intended recipient, please contact the sender as soon as possible. The views expressed in this communication may not necessarily be the views held by BTA. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: forcing downloads
Hi folks.. can anyone help us out with this one, it should be so simple and I just can't accept all the hassle we've been having to try and figure it out. What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) surely this is a simple operation? ... I really hope somebody can make me look stoopid with the answer.. in hope .jez Jeremy Becker ([EMAIL PROTECTED]) This thread pops up ever week or so... There are several problems with different browsers platforms (incompatibilities, partial implementations and outright bugs) Based on help from several others, I think that the following will work on most current browsers. It downloads either a text file or a TSV file which normally would be displayed. It gets the correct name (must be supplied with the form or the link) I have testes successfully on: Mac IE 5.x Mac NN 4.x Win IE 4.x Win IE 5.x Win NN 4.x If you can test it on any other platforms, it would help. the URL: http://.instasales.com/Samples/DownloadFile/DownloadFile.cfm Give it a try! Dick The Source: CFSETTING ENABLECFOUTPUTONLY=YES !--- --- !--- StandAloneDownload.cfm --- !--- --- !--- Requests a download then performs that download --- !--- --- !--- Due to a Bug in MSIE 5.x , we must include the File Name in --- !--- the Form or Link URL of the page called to invoke the--- !--- download.--- !--- --- !--- We do this in the form: --- !--- --- !--- TemplateName.cfm/FileName/ --- !--- --- !--- For example: --- !--- --- !--- form action=StandAloneDownload.cfm/Test.txt/ --- !--- --- !--- or --- !--- --- !--- a href=StandAloneDownload.cfm/Test.txt/--- !--- --- !--- --- !--- --- !--- MSIE 4.x will try to display a file type that it recognizes, --- !--- in particular text and html files. To prevent this, we --- !--- trick the browser by supplying an fake file name (without --- !--- a suffix). --- !--- --- !--- --- cfset tab = chr(9) cfset crlf = chr(13) chr(10) !--- Get the File Path set in application.cfm --- cfset FilePath = Request.FilePath cfif isdefined(BeginDownload) !--- --- !--- Download the File--- !--- --- cfset RequestedFileType = ListLast(ListLast(CGI.Path_Info, /), .) cfif RequestedFileType eq tsv cfset FileName = Test.tsv cfset FakeName = Test.tsv cfset FileType = text/tab-separated-values cfset FakeType = -#FileType#- cfelse cfset FileName = Test.txt cfset FakeName = Test cfset FileType = text/unknown cfset FakeType = -#FileType#- /cfif cfif ReFindNoCase(MSIE, CGI.HTTP_USER_AGENT) cfheader name=Content-type value=#FileType# cfheader name=Content-Disposition value=attachment; filename=#FakeName# cfcontent type=#FakeType# file=#FilePath##FileName# cfelse cfheader name=Content-type value=#FileType# cfheader name=Content-Disposition value=attachment; filename=#FileName# cfcontent type=#FileType# file=#FilePath##FileName# /cfif cfelse !--- --- !--- Show Download Request Form --- !---
RE: forcing downloads
Opera 5.12 on Windows 2000 Pro through paranoid corporate firewall reports Connection closed by remote server. |--+--| |Eric A. Laney |Happiness:| |Systems Engineer |An agreeable sensation arising from contemplating the | |LAN Optimization |misery of another.| |Team | | |Voice:| | |813.978.4404 | | |Pager:| | |888.985.8519 | | |--+--| Dick Applebaum To: CF-Talk [EMAIL PROTECTED] dick@lacara.cc: com Subject: RE: forcing downloads 07/27/2001 08:08 AM Please respond to cf-talk Hi folks.. can anyone help us out with this one, it should be so simple and I just can't accept all the hassle we've been having to try and figure it out. What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) surely this is a simple operation? ... I really hope somebody can make me look stoopid with the answer.. in hope .jez Jeremy Becker ([EMAIL PROTECTED]) This thread pops up ever week or so... There are several problems with different browsers platforms (incompatibilities, partial implementations and outright bugs) Based on help from several others, I think that the following will work on most current browsers. It downloads either a text file or a TSV file which normally would be displayed. It gets the correct name (must be supplied with the form or the link) I have testes successfully on: Mac IE 5.x Mac NN 4.x Win IE 4.x Win IE 5.x Win NN 4.x If you can test it on any other platforms, it would help. the URL: http://.instasales.com/Samples/DownloadFile/DownloadFile.cfm Give it a try! Dick The Source: CFSETTING ENABLECFOUTPUTONLY=YES !--- --- !--- StandAloneDownload.cfm --- !--- --- !--- Requests a download then performs that download --- !--- --- !--- Due to a Bug in MSIE 5.x , we must include the File Name in --- !--- the Form or Link URL of the page called to invoke the--- !--- download.--- !--- --- !--- We do this in the form: --- !--- --- !--- TemplateName.cfm/FileName
RE: forcing downloads
I've had a decent luck by using cfheader name=Content-Disposition value=inline; filename=report.xls before the cfcontent tag. HTH Marlon -Original Message- From: Cold Fusion [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 12:00 PM To: CF-Talk Subject: forcing downloads Hi folks.. can anyone help us out with this one, it should be so simple and I just can't accept all the hassle we've been having to try and figure it out. What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) surely this is a simple operation? ... I really hope somebody can make me look stoopid with the answer.. in hope .jez Jeremy Becker ([EMAIL PROTECTED]) 100 High Street Wandsworth London SW18 4LA United Kingdom Tel: 020 8871 4240 Fax:020 8871 4584 http://www.bta.com Network Consultancy and Support for Windows 9x/NT and MacOS. Internet connectivity, solutions, and business services. This message is intended only for the use of the person(s) (The intended recipient(s)) to whom it is addressed. It may contain information which is privileged and confidential within the meaning of applicable law. If you are not the intended recipient, please contact the sender as soon as possible. The views expressed in this communication may not necessarily be the views held by BTA. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: forcing downloads
I've actually looked into this an have yet to get it to find a solution, I would be interested in the answer. For our purposes we want the user to be able to click on a link and the output of the report will be put into an .xls file which they can download to their desktop. Whether the goes to the browser or directly to excel is unimportant, one way the user would have to do a file-save as, the other way it would just go directly to the directory they choose, either way will work. What we want to avoid is writing any .xls files to the server even temporarily due to the sensitivity of the data. I've tried several custom tags from the allaire gallery as well, but have been unable to get them to work, so I have set this task aside for the time being. Casey Cook Cold Fusion [EMAIL PROTECTED] on 07/26/2001 12:00:17 PM Please respond to [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] cc: Subject: forcing downloads Hi folks.. can anyone help us out with this one, it should be so simple and I just can't accept all the hassle we've been having to try and figure it out. What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) surely this is a simple operation? ... I really hope somebody can make me look stoopid with the answer.. in hope .jez Jeremy Becker ([EMAIL PROTECTED]) 100 High Street Wandsworth London SW18 4LA United Kingdom Tel: 020 8871 4240 Fax:020 8871 4584 http://www.bta.com Network Consultancy and Support for Windows 9x/NT and MacOS. Internet connectivity, solutions, and business services. This message is intended only for the use of the person(s) (The intended recipient(s)) to whom it is addressed. It may contain information which is privileged and confidential within the meaning of applicable law. If you are not the intended recipient, please contact the sender as soon as possible. The views expressed in this communication may not necessarily be the views held by BTA. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: forcing downloads
Cold Fusion wrote: What we want to do is have the user click a link to a cfm file, that cfm file then returns a file (for arguements sake a .xls file) which starts to download to the users machine (forcing download rather than returning to browser). There is no way to force a download in HTTP. You can only imply the suggestion of a download by setting the type to application/octet-stream in your cfcontent tag. We've tried using CFCONTENT and setting the type to unknown, this will start the file downloading all right but the name that appears in the dialog boxes is the name of the orginal cfm file that was called rather than the name of the actual file (i.e. saves as download.cfm rather than file2download.xls ) To get the right filename add a cfheader: cfheader name=Content-Disposition value=attachment; filename=#chr(34)#fname.ext#chr(34)# Jochem ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists