Why response.setHeader("Content-Disposition","filename=" + filename); doesnt work with Konqueror, Opera and Mozilla...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Javier_Sanchez
Posted On:   Wednesday, May 8, 2002 10:05 AM

when i download the attachment from the servlet it suppose to appears the filename in the save box but only works in IExplorer and Netscape in other browsers appears the world "attachment", how can i make it work in konqueror, mozilla and opera, obviously i set the header and content type, here is a part of the code: Multipart multipart = (Multipart)msg.getContent(); Part part = multipart.getBodyPart(partNum); String sct = part.getContentType(); if (sct == null) { out.println("invalid part"); return; } ContentType ct = new ContentType(sct); response.setContentType(ct.getBaseType()); response.setHeader("Content-Disposition",&quo   More>>


when i download the attachment from the servlet it suppose to appears the filename in the save box but only works in IExplorer and Netscape in other browsers appears the world "attachment", how can i make it work in konqueror, mozilla and opera, obviously i set the header and content type, here is a part of the code:




			
Multipart multipart = (Multipart)msg.getContent();
Part part = multipart.getBodyPart(partNum);
String sct = part.getContentType();
if (sct == null) {
out.println("invalid part");
return;
}
ContentType ct = new ContentType(sct);
response.setContentType(ct.getBaseType());
response.setHeader("Content-Disposition","filename=" + part.getFileName());
System.out.println(part.getFileName());
System.out.println(part.getDisposition());
InputStream is = part.getInputStream();
int i;
while ((i = is.read()) != -1)
out.write(i);
out.flush();
out.close();
   <<Less
About | Sitemap | Contact