点击一个按钮,我就可以将excel表下载到一个特定的文件夹中。文件已成功保存。
代码是这样的:
Workbook wb = initWorksheet(form);
String exportFilePath =ResourceBundle.getBundle("Test").getString("Test_export_file_path"); //file path from properties file
FileOutputStream fileOut = new FileOutputStream(exportFilePath + "/" + getNewFileName(fileName, exportFilePath));
wb.write(fileOut); // sheet is successfully downloaded at folder specified.
output = fileOut.toString();
fileOut.close();
(HttpServletResponse
响应发送成功,出现保存/另存为弹出窗口!(
但是,当我在浏览器的保存弹出窗口上单击保存按钮时,具有相同名称和扩展名的excel文件会下载到系统的下载文件夹中(但该文件已损坏,我们无法打开它(
所以我想要的是,即使我在浏览器的弹出窗口中单击"保存",我也希望文件在我的属性文件中提到的相同路径下载(此处为exportFilePath路径(
有人能帮我吗!
您不能更改用户浏览器保存下载的位置。