python - Send PIL Image from Django View to Browser for Download via HttpResponse -


i'm trying send pil image django view browser automatic download. code below seems work many:

 response = httpresponse(content_type='image/jpg')  pil_imagetosend.save(response, "jpeg")  response['content-disposition'] = 'attachment; filename="name.jpg"'  return response 

i call django view through ajax, , when print callback looks jpeg image, no download triggered. missing download automatically trigger?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -