0

I am currently developing an application where in users can download youtube video.However when I am trying to give a href link , it is streaming the video in another tab rather than popping up save as option in FireFox/Chrome.How should i force the browsers to show download popup?

My Views.py

Dow is a basic function using pafy.

def res(request):
    if request.method == "POST":
      url = request.POST['ylink']
      res = dow(url)
      # response['Content-Disposition'] = 'attachment; filename=myfile.m4a'
      return render(request,"result.html",{'res':res})

HTML :

<html>
  <h1><a href = "{{res}}">Click Here to Download the Video</a></h1>
</html>

I read about content disposition in other questions but all of them are related to HttpResponse which I am not using here. P.S : I am a beginner in Django trying to be a pro! over time

Eylen
  • 2,617
  • 4
  • 27
  • 42
Bhargava Sharma
  • 151
  • 1
  • 2
  • 7
  • 2
    Replication? http://stackoverflow.com/questions/1156246/having-django-serve-downloadable-files – agastalver Jun 08 '15 at 08:15
  • Hi,I didnt get you.I am trying to render this file.However, it is still streaming despite giving content disposition value in render function.I am sorry I am just a beginner @Eylen – Bhargava Sharma Jun 08 '15 at 09:48

0 Answers0