2021年3月26日星期五

Django: media file: How make it downloadable

Django, I have a file in media folder and i want to have a download button in my html, onclicking it should download that file

I think the headers have to be changed to attachment instead of inline. Something like

the specific static file response ["Content-Disposition"]= "attachment; filename=something.someext"  

So how can i do this in Django. Or what is the best way to do this.

Its a fixed file and no need for me to get any information from user or database.

https://stackoverflow.com/questions/66827232/django-media-file-how-make-it-downloadable March 27, 2021 at 09:34AM

没有评论:

发表评论