Can anyone explain this...

H

Harry

after some excellent help a while back on this forum I wrote some code to
allow, when a users clicks on a button on a web page, a excel file to be
created & zipped up on the fly & downloaded to the user's pc.

something like this -

////////////////////////////////////////////////////////////////////////////
/

HSSFWorkbook wb = getExcelWorksheet();
String fileName = "testfile";

response.setContentType("application/x-zip-compressed");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName
+ getExtension(request));

ZipOutputStream out = new ZipOutputStream(response.getOutputStream());


out.putNextEntry(new ZipEntry(fileName + ".xls"));

wb.write(out);

out.close();

////////////////////////////////////////////////////////////////////////////
/

the getExtension() bit returns ".zip" if IE or "" if Netscape (NN 7.1 adds
".zip" on itself!)

The problem is in IE I get the 2 standard download options "open the file
from its current location" or "save to disk".
"save to disk" works fine, but when you click to "open......" it
immediately redisplays the download dialog box, click it again & it works!

What am I doing to cause this? - NN seems to handle it fine i.e "open it
with default application (winzip) on 1st click but IE 5.5 (sp2) & IE 6 (sp1)
does it on second!

any ideas

thanks - hopefully I've explained it clear'ish!

harry
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top