Avoiding content type issues when downloading a file via browser on Android

后端 未结 5 1772
無奈伤痛
無奈伤痛 2020-11-29 02:24

If I have a file made available to a browser through my webapp, I normally just set the URL to something like http://website.com/webapp/download/89347/image.jpg

5条回答
  •  抹茶落季
    2020-11-29 02:49

    To make any downloads work on all (and especially older) Android versions as expected, you need to...

    1. set the ContentType to application/octet-stream
    2. put the Content-Disposition filename value in double quotes
    3. write the Content-Disposition filename extension in UPPERCASE

    Read my blog post for more details:
    http://digiblog.de/2011/04/19/android-and-the-download-file-headers/

提交回复
热议问题