Git Product home page Git Product logo

django-multiple-file-chunked-upload's People

Contributors

tcztzy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

django-multiple-file-chunked-upload's Issues

Upload fails on md5 calculation

I am trying to use this module in my project. I had to apply only one change in views to generate dataset_name on fly without asking for form field for it, so I replaced

dataset = self.get_or_create_dataset(request.POST.get('dataset_name'))

with

dataset_name = "dsname_%s" % chunk._get_name()
dataset = self.get_or_create_dataset(dataset_name)

But now, when view executes this line:

if chunked_upload.is_finished:

it fails in the model in this part:

    @property
    def md5(self):
        md5 = hashlib.md5()
        for chunk in self.file.chunks():
            md5.update(chunk)
        return md5.hexdigest()

particurarly at line

for chunk in self.file.chunks():

when he tries to loop over all chunks.

I tried this code with django-1.9.1 and also 1.11.2 and it is all the same.

I made some small changes to debug the problem:

@property
    def md5(self):
        print("f0")
        md5 = hashlib.md5()
        print(self.file)
        print(self.file.chunks())
        for chunk in self.file.chunks():
            print("f1")
            md5.update(chunk)
        print("f2")
        return md5.hexdigest()

and the output is

f0

<generator object File.chunks at 0x7fd3af0f10f8>
[22/Aug/2017 12:25:14] "POST /upload/chunk/ HTTP/1.1" 500 67

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.