Closed htmfilho closed 6 years ago
Hello,
I'm trying to implement a file download using ring in a way that it forces the browser to open a window to save the file, instead of opening the file in the browser. I've implemented the following function, but it is not behaving as expected:
(defn download-document [id] (let [document (document-model/get-it id)] (-> (file-response "/path/to/my/document/ugly_file_name.pdf") (header "Content-Disposition" "attachment; filename=\"nice_file_name.pdf\"") (content-type "application/pdf") (header "Content-Length" 3746220))))
The pdf file is still opening in the browser with the ugly file name.
Any hint how to achieve that ? Thank you very much in advance.
What middleware are you using? What adapter are you using? What does the head of the HTTP response look like?
Closing due to no response.
Hello,
I'm trying to implement a file download using ring in a way that it forces the browser to open a window to save the file, instead of opening the file in the browser. I've implemented the following function, but it is not behaving as expected:
The pdf file is still opening in the browser with the ugly file name.
Any hint how to achieve that ? Thank you very much in advance.