Android Chrome browser unnecessarily renames names & types of downloaded files

前端 未结 3 1310
暗喜
暗喜 2021-01-28 23:41

I thought I\'d repost this since I have more detailed information:

THE ISSUE: Android Chrome browser renames a file to \"Download\" in all cases. It renames the type t

3条回答
  •  深忆病人
    2021-01-29 00:30

    I had a similar problem with downloads on Chrome/Android. .docx files were renamed to filename.bin (or something like that).

    Headers included

    Content-Type:application/octet-stream
    

    and

    Content-Disposition:attachment; filename="something.docx";
    

    Turned out that my problem was in trailing semicolon in "Content-Disposition" header. When there is no semicolon at the end of the line - it works fine:

    Content-Disposition:attachment; filename="something.docx"
    

    More info here: http://www.digiblog.de/2011/04/android-and-the-download-file-headers/

    So, be sure to check that as well.

提交回复
热议问题