Roland,

Have you found that Netscape *never* shows the correct file name (without 
the .do) when downloading? It appears to me that if Mozilla "understands" 
the file content type, the file name will appear correctly in the download 
dialog box. But if it doesn't (meaning application/octet-stream), then it 
displays the .do at the end of the file name. Apparently IE determines the 
content type differently (figures out what the file type is itself), so 
therefore displays a correct file name. 

How are you setting the content type in your download? I am currently 
trying something like the following: 

String mimeType = 
URLConnection.getFileNameMap().getContentTypeFor(fileName);
if (mimeType != null) {response.setContentType(mimeType);}
else {response.setContentType("application/octet-stream");}
response.setHeader("Content-Disposition", "attachment; filename=" + 
fileName);

Although I am not exactly sure where this (URLConnection) content type 
information comes from. I hesitate to manually list out content types, 
since there are so many, but perhaps that is what most people do?

Sorry I can't provide an answer, but I would be interested to hear if you 
gain some insight on this.

Thanks,
Susan Bradeen

On 03/10/2003 12:40:26 PM "Roland Berger" wrote:

> Hi all
> 
> Craig has described in the thread "File upload/download design question" 
how
> to download a file from within an action. Others have described how to 
set
> the Header so that the browser is promting for the right filename:
> 
> response.setHeader("Content-Disposition","attachment; filename=\"" +
> myFileName+ "\";");
> 
> The later does not work with netscape version 7 ( it does work with IE 6 
).
> In the popup, the browser suggests  the filename like this: 
<myFileName>.do
> . One year has passed by since and world has become more clever 
(sometimes I
> think the opposite). Is there a more definitv guide to suggest the 
filename
> of the download?
> 
> Thank's
> Roland
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to