[Answered ]-Django: mobile browser doesn't trigger download instead loads the file into browser

2👍

Thanks to Sayse the trick was to specify the mimetypes in the content_type header

import mymetypes

response = HttpResponse(content_type=mimetypes.guess_type(file_name))
response.write(docfile)
response['Content-Disposition'] = 'attachment; filename={0}'.format(file_name)
return response

Leave a comment