I need to serve arbitrary files to the browser as an attachment. Since the filenames must be in unicode format, I used the trick the django framework uses (as linked under How to encode UTF8 filename for HTTP headers? (Python, Django) in the answer by Pierre-Jean Coudert).
For IE browsers, the solution seems to be not to send any file name via the header but just attachment as a Content-Disposition and to embed the file name in the URL.
This works partially: IE9 changes the extension of these downloads to .htm, no matter what I try to download. For instance:
For instance, /my/url/image.jpg with header Content-Disposition: attachment; and Content-Type: image/jpeg; will download as image.htm.
Any idea to work around this?
Aucun commentaire:
Enregistrer un commentaire