Пример #1
0
    def post(self, *args, **kwargs):
        """Saves chunks then checks if the file is complete."""

        message=""


        uploader = self.request.POST.get('uploader',None)
        if uploader == 'plupload':
            message = self.handle_plupload_post(*args, **kwargs)
        else:
            chunk = self.request.FILES.get('file')
            r = ResumableFile(self.storage, self.request.POST)
            if r.chunk_exists:
                if r.is_complete:
                    message = self.process_file(r.filename, r.file)
                    r.delete_chunks()
                    return HttpResponse(message)
                else:
                    return HttpResponse('chunk already exists new')
            r.process_chunk(chunk)


            if r.is_complete:
                message = self.process_file(r.filename, r.file)
                r.delete_chunks()
        return HttpResponse(message)
Пример #2
0
 def post(self, *args, **kwargs):
     """Saves chunks then checks if the file is complete.
     """
     chunk = self.request.FILES.get('file')
     r = ResumableFile(self.storage, self.request.POST)
     if r.chunk_exists:
         return HttpResponse('chunk already exists')
     r.process_chunk(chunk)
     if r.is_complete:
         self.process_file(r.filename, r.file)
         r.delete_chunks()
     return HttpResponse()
Пример #3
0
    def post(self, *args, **kwargs):
        """Saves chunks then checks if the file is complete.
        """
        chunk = self.request.FILES.get('file')
        r = ResumableFile(self.storage, self.request.POST)
        if r.chunk_exists:
            return HttpResponse('chunk already exists')
        r.process_chunk(chunk)
        if r.is_complete:
            resource = Resource.objects.get(id=kwargs["resource_id"])
            self.process_file(r.filename, r, resource)
            r.delete_chunks()

            return HttpResponseRedirect(resource.get_absolute_url())
        return HttpResponse()