publishers_17.py 378 B

12345678910
  1. def upload_download(request, contentupload_id):
  2. upload = models.ContentUpload.objects.get(pk=contentupload_id)
  3. response = StreamingHttpResponse(open(upload.file_path, "r"))
  4. response["Content-Type"] = "application/octet-stream"
  5. response["Content-Disposition"] = 'attachment; filename="%s"' % os.path.basename(
  6. upload.file_path
  7. )
  8. return response