?
Solved

CFContent and Content-Disposition cannot force download/save file to hard drive.

Posted on 2005-03-21
11
Medium Priority
?
266 Views
Last Modified: 2013-12-24
A Web server that uses the Content-disposition: attachment HTTP header to force a file download should prompt the user to open or save the file; however, in Internet Explorer 5.5 Service Pack 1 (SP1), the user is prompted to open or save the HTML file instead.

However, this method works fine in Firefox, but I cannot assume all of my online customers will be using Firefox, or an updated version of IE that has implemented MS's fix/workaround to the problem, as indicated in the following KB article.

http://support.microsoft.com/kb/q279667/

Is Content-Disposition required for Cold Fusion's Cfcontent to work properly?

Here is the error I am getting now.  http://www.esiacademy.com/test.cfm

I guess ultimately that I do not need to force download, and that I can just provide a hyperlink to the download document.  If I cannot find a reasonable alternative to the issue descirbed above, that is what I will end up doing.




0
Comment
Question by:gmahler5th
  • 5
  • 4
  • 2
11 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 13595100
<cfheader name="Content-Disposition" value="filename=exam.pdf">

Regards
Plucka
0
 

Author Comment

by:gmahler5th
ID: 13595343
Have you tested this in IE?

Do I use it in combination with cfcontent, or in place of cfcontent?
0
 

Author Comment

by:gmahler5th
ID: 13595434
I tested this on my local machine and http://www.esiacademy.com/test.cfm  -- It's trying to download test.cfm and not the exam.pdf file.

0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LVL 18

Expert Comment

by:Plucka
ID: 13595756
I do this all the time in IE.

Can you paste the code from start to cfcontent and i'll try it this end.

Regards
Plucka
0
 

Author Comment

by:gmahler5th
ID: 13595785
<cfheader name="Content-Disposition" value="inline; filename=exam.pdf">

<cfcontent type="application/pdf" file="c:\exam.pdf" deletefile="yes">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
Downloading....
</body>
</html>
0
 
LVL 14

Expert Comment

by:Renante Entera
ID: 13607941
Hi gmahler5th!

Try removing "file extension" on your "<cfheader>" tag and change your "type" on "<cfcontent>" tag with "application/unknown".

This will be the revised code :

<cfheader name="Content-Disposition" value="inline; filename=exam">

<cfcontent type="application/unknown" file="c:\exam.pdf" deletefile="yes">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
Downloading....
</body>
</html>

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 
LVL 18

Accepted Solution

by:
Plucka earned 900 total points
ID: 13608007
This is how we do it.

<cfheader name="content-disposition" value="attachment; filename=exam.pdf" />
<cfcontent type="application/pdf" file="c:\exam.pdf" deletefile="yes" />

Note the attachment option.

Regards
Plucka
0
 

Author Comment

by:gmahler5th
ID: 13608043
I am running Cold Fusion MX 7.0 and Internet Explorer 6.x

What CF server are you testing this on, and in which browser?

Could you upload a working version to a public web server?
0
 
LVL 14

Assisted Solution

by:Renante Entera
Renante Entera earned 600 total points
ID: 13608078
Ooops....  Sorry!  Kindly ignore my first comment.

How about doing it like this :

<cfheader name="Content-Disposition" value="inline; filename=exam.pdf">
<cfcontent type="application/pdf" file="c:\exam.pdf">

*Note : Remove this part [deletefile="yes"] on "<cfcontent>" tag.


Regards!
eNTRANCE2002 :-)
0
 

Author Comment

by:gmahler5th
ID: 13617676
I found the answer to this issue in a Macromedia forum.  Essentially, add ?/foo.pdf as a query paraemeter to the file that has the CFHeader tag in it and which forces download.

http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=7&threadid=935210&CFID=31871719&CFTOKEN=da91219c477ebae5-CED0489A-D3FA-8238-BFE2939F0C6E1A5B&jsessionid=96304a6349511f7e6c96

I will award points for effort.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 13625612
Clever,

Didn't know you could do that, then again never had any problems.

Regards
Plucka
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question