Hi,
I have the following code
def fileDoc = new File(document.documentLocation);
if(fileDoc.exists()){
// force download
def fileName = fileDoc.getName();
response.setContentType("application/octet-stream")
response.setHeader "Content-disposition", "attachment; filename=${fileName}" ;
response.outputStream << fileDoc.newInputStream();
response.outputStream.flush();
return true;
}
documentLocation contains string like "c:\mydoc\contains_some_long_string_with_id.pdf" for example.
I would like the user to download the file instead view it from browser. It works well on chrome where I could download and the file will be show up "save as" "contains_some_long_string_with_id.pdf"
but in firefox (latest one) .. the filename is crippled to "contains_some_long" only (without pdf extension at the end).
How to solve this problem ? the file could be csv,pdf, text, html, zip, pdf or other file format.
thank you