File download dialog box problem!
843835Mar 24 2002 — edited Aug 28 2007Dear everbody
How do you force file download message box to use specified file name instead of JSP or servlet name.?
I am using the following code:
file1.jsp
..
frmlist.action = "download.jsp";
frmlist.submit();
..
download.jsp
...
String fileName = "inventory.xls";
Disposition","attachment;filename=\"inventory.xls\"");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/msexcel");
...
With the above code, browser first pop up file download dialog box informing
'You are downloading the file:[download.jsp] from host. Would u like to open the file or save?'
I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the jsp name
i have read all forum topic and tried every way, question still exists, maybe i forget any important set or something. hope to get your tips!
Thanks
Luke