?
Solved

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

Posted on 2005-03-21
11
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

765 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