I need to write a download servlet in java to download a file from the web server. I am setting the response parameters as follows:
resp.setContentType( (mimetype != null) ? mimetype : "application/octet-stream");
resp.setContentLength( (int)f.length() );
resp.setHeader( "Content-Disposition",
"attachment; filename=\"" + filename + "\"" );
The code seems to work fine with firefox, chrome and IE7 but with IE6 its adding "[1]
" in the middle of the filename. E.g. test[1]_check.txt
(instead of test_check.txt
). There are no duplicate copies of the file on client side and I'm unable to understand where I'm going wrong. Is there an issue with my response parameters?
Thanks in advance