Download Servlet for .zip-Files on IE 6 and https

S

StefanSt

Hello,

my Servlet creates a zip-File on the fly and works fine, but with https
and IE 6 there is a problem:
The filename in the Download-Box of IE is not correct and the file
extension .zip isn't there.

SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd__HH:mm:ss");
String zipFile=sdf.format(new Date()) +".zip";
res.setContentType("application/zip");
res.setHeader("Content-Disposition", "attachment;filename=\""+ zipFile
+"\";");
....
....

With Firefox: no problems

thanks

Stefan
 
R

Roedy Green

SimpleDateFormat("yyyy-MM-dd__HH:mm:ss");

colon is a reserved char in windows filenames. It means drive letter.

Stick to a very vanilla set of filename chars if you want to avoid
trouble on all platforms.

Also I think it wise to start a filename with an alpha character --
treat it much like a Java identifier.

And finally I think a filename should give some clue as to what the
file is when seen in isolation, so you might name it something like

dailyraceresults2005-08-23-235959.zip

Unless it lives in a directory with nothing but similar files, than
the directory name can give that info. e.g.

dailyraceresults/d2005-08-23-23_59_59.zip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top