Hi, Thanks for the suggestions. I've found that if I set the following, then the correct File Download dialog appears
response.setHeader("Pragma", ""); response.setHeader("Expires", ""); -Ed. -----Original Message----- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Thursday, October 14, 2004 9:30 AM To: Struts Users Mailing List Subject: Re: Streaming an attachment from an Action not working with Internet Explorer Ed My experience is that the majority of Microsoft programs (IE) default to saving contents to %USERPROFILE% folder I would suggest using fully qualified pathname %TOMCAT_HOME%\\webapps\\testDownload\\TextDownloadByOctectStreamWithoutForwa rd.txt (instead of relative path..) Anyone else? Martin- ----- Original Message ----- From: "Susan Bradeen" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, October 14, 2004 8:56 AM Subject: Re: Streaming an attachment from an Action not working with Internet Explorer > On Wed, 13 Oct 2004 13:12:23 -0400, Moynihan, Edward > <[EMAIL PROTECTED]> wrote: > > Hi, > > Can anyone point me in the right direction with the following problem that I am experiencing. > > > > I've written a very simple action that streams back to the client an attachment. So, here is a code snippet from the action to illustrate what I am doing. Assume that the URL to hit the action is /testDownloadAction.do and I am using https instead of http. > > > > response.setContentType("application/octet-stream"); > > response.setHeader("Pragma", "no-cache"); > > response.setHeader("Expires", "-1"); > > > > buf = new StringBuffer(); > > buf.append("attachment;filename=").append("TextDownloadByOctectStreamWithout Forward.txt"); > > response.setHeader("Content-Disposition", buf.toString()); > > > > I don't have reason to believe that StringBuffer is working here, but > just in case have you tried something like: > > response.setHeader("Content-Disposition", "attachment; filename=\"" + > "TextDownloadByOctectStreamWithoutForward.txt;" + "\""); > > or perhaps you are just missing some escaped quotes around your filename? > > > > writer = response.getWriter(); > > writer.write("Sending down some text. This is a text download without a forward"); > > writer.flush(); > > writer.close(); > > > > actionForward = null; > > > > When I use FireFox, I get a FileDownload dialog and I am allowed to save the file of name "TextDownloadByOctectStreamWithoutForward.txt". > > However, when I use IE 6.0 the FileDialog pops up and says that the file name is "testDownloadAction.do". If I try to hit Save, IE comes back with an error. > > > > Does anyone have any resources to help me understand why this is not working in IE? > > > > Thanks. > > > > -Ed. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]