Download file with original file name
You just fetch the originalName from the database and set it in the Content-Disposition
header:
@RequestMapping("/../download")
public ... download(..., HttpServletResponse response) {
...
response.setHeader("Content-Disposition", "attachment; filename=\"" + original + "\"");
}
You should set your origin file name into the response header, like below:
String fileName = URLEncoder.encode(tchCeResource.getRname(), "UTF-8");
fileName = URLDecoder.decode(fileName, "ISO8859_1");
response.setContentType("application/x-msdownload");
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
Hope to help you:)