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