5

I have a table in which I have a blob column containing some data, how can i download the blob content in django? I tried the solution mentioned here but it didn't work for me

Community
  • 1
  • 1
user2137817
  • 1,825
  • 5
  • 28
  • 45

1 Answers1

6
def download_blob(request, id):

    contents = BlobModel.objects.get(id=id).blob_field

    response = HttpResponse(contents)
    response['Content-Disposition'] = 'attachment; filename=blob.bin'
    return response
Thomas
  • 11,757
  • 4
  • 41
  • 57