gmahler5th
asked on
CFContent and Content-Disposition cannot force download/save file to hard drive.
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.
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.
ASKER
Have you tested this in IE?
Do I use it in combination with cfcontent, or in place of cfcontent?
Do I use it in combination with cfcontent, or in place of cfcontent?
ASKER
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.
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
Can you paste the code from start to cfcontent and i'll try it this end.
Regards
Plucka
ASKER
<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>
<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>
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 :-)
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"
<cfcontent type="application/unknown"
<!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 :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
What CF server are you testing this on, and in which browser?
Could you upload a working version to a public web server?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
Clever,
Didn't know you could do that, then again never had any problems.
Regards
Plucka
Didn't know you could do that, then again never had any problems.
Regards
Plucka
Regards
Plucka