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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing the correct extension when downloading files 2

Status
Not open for further replies.

cturland

Programmer
Sep 25, 2000
66
GB
When I want to download a file from a Cold Fusion page, I use the CFCONTENT tag, for example:
<CFCONTENT TYPE=&quot;application/msexcel&quot; FILE=&quot;#vFilePath#DEPT.xls&quot; DELETEFILE=&quot;No&quot;>

When the save box shows on the client, it always defaults the extension to .cfm.
Does anybody know how we can fix this?

Also, is there any other way of initiating a download?
 
This same question was asked a few weeks ago by ketankshah. Take a look at this thread as I think the info will give you an understanding of the issues and some suggestions. His post starts off with a different question but changes to a discussion of what you're trying to do.


Good luck,
GJ
 
Your content tag is fine, but you need a CFHEADER tag above it.

<!--- page1.html --->
<a href=&quot;download.html&quot;>here</a><br>

<!--- download.html --->
<CFSET myFile = &quot;Template.html&quot;>

<CFHEADER NAME=&quot;content-disposition&quot; VALUE=&quot;attachment; filename=#myFile#&quot;>

<CFCONTENT TYPE=&quot;application/unknown&quot; FILE=&quot;#templateDir#\#myFile#&quot; DELETEFILE=&quot;No&quot;>

Make sure your file exists on the server.
 
Thanks for your suggestion of using the <CFHEADER tag.
This allows the user to see the correct file name in the save box when downloading the file.

But ... it seems to cause another problem.
Sometimes, after downloading the file, it leaves the mouse pointer on the browser as an hourglass.

For example.
With the CFHEADER tag
I click on the download hyperlink and the Download File box appears. Once this box has appeared and I wave my mouse around on the page behind, I get an hourglass pointer. If I click Cancel at this point, the box disappears and the mouse returns to normal.
If I select the Save to Disk radio button, and click OK, then the mouse pointer on the screen remains as an hourglass, even after I have finished downloading. If I click Cancel on the Save box, the hourglass remains.

Without the CFHEADER tag
If I click on the download link, the Download File box appears. Once this box has appeared and I wave my mouse around on the page behind, I get a standard mouse pointer.
If I choose to save, and click Cancel from the save dialog box, the mouse pointer returns to normal.

I think the mousepointer discussion may warrant a new thread because I have had similar problems when opening new windows and moving the mouse back over the opener while the new page is loading.

I am using IE5 and have not tried this in any other browsers.

Any ideas???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top