I have sended a mesages last friday with a much basic question about this.
Now I am advanced. I am programing a servlet that allows downloading files.
In the servlet i make switch(browser), and do what each browser needs. In IE
5.5 and Netscape 4.7 i sworking well.
In IE 5.0 I have 2 problems:
a) Downloading a gif file, the dialog that ask the user if he wants to "open
the file from its current location" or "download the file", appears as I
expected, and the filename tha appears is rigth. The problem is when the
user chooses "open the file from its current location" . The browser
windows turns white, and in the status bar says "receiving file xxxx.gif",
but it never receives it.
b) For files the browser doesn't recognizes (zip files, log, and so on), the
user can open from its current location or download it, but after
downloading it, the mouse appears with the clock rounding, as if the stream
of data wasn't fully received, althougth I specially do out.close().
Here is the code I use:
String userAgent = request.getHeader("user-agent");
if (userAgent != null && userAgent.indexOf(" MSIE 5.0") >= 0) {
response.setContentType("bad/type");
response.setHeader("Content-Disposition", "inline; filename=" +
sNombreArchivo);
ServletOutputStream out = response.getOutputStream();
out.write(byte[] con el contenido del archivo);
out.flush();
out.close();
}catch (IOException e){
e.printStackTrace();
}
I tryed too changing response.setContentType("bad/type") for
response.setContentType("application/octet-stream") and
response.setHeader("Content-Disposition", "inline..... for
response.setHeader("Content-Disposition", "attachment....., but fixed a
problem while generating a new one.
Does somebody know how exactly should it done for IE 5.0?
--------------
Oscar Guindzberg
[EMAIL PROTECTED]
++54-11-4345-0537 (int. 132)
Java Development Team
Soluciones Integrales S.A.
Buenos Aires - Argentina
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html