0

im tying to send requested video file to client to start download ..

file addrees(that is hashed) is comming to server, and it should return file to download ... Now when i enter url like below in browser , it works ,

"
localhost:8000/api/v1/store/download/?q=e8000074ab4d,eJwLyygpKbDS18/JT07MycgvLrGyMDAw0C8tyMlPTNFPy8xJ1U9M1MstMOEqMODSAwB4gQ8P"

but in client side when i make the same request i takes error like this:

Http failure response for (unknown url): 0 Unknown Error"
​
name: "HttpErrorResponse"

in firefox and in chrome i takes empety response frome server

my view is like this

class DownloadVideoAPI(APIView):
    def get(self, request, ):
        query = request.GET.get('q')
        pre = query.split(",")
        hash = pre[0]
        dec = pre[1]
        de_hash = decode_data(hash, dec)
        if de_hash is not None:
            resp = HttpResponse()
            resp['Content-Disposition'] = 'attachment; filename=%s' % de_hash
            resp['content_type'] = 'application/force-download'
            return resp
        else:
            return Response(status.HTTP_400_BAD_REQUEST)

where is the problem and how can i fix it?

jicke
  • 83
  • 1
  • 2
  • 8
  • This might help you: https://stackoverflow.com/questions/1156246/having-django-serve-downloadable-files – T.Tokic Apr 28 '18 at 16:46
  • "but in client side when i make the same request i takes error" -- can you show the client side code that is making the request? – Will Keeling Apr 30 '18 at 09:58

0 Answers0