flowjs / flow.js

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.
Other
2.97k stars 347 forks source link

Cannot read property 'file' of undefined #246

Closed ssheth28 closed 6 years ago

ssheth28 commented 6 years ago

When i upload image/video one after another (e.g. one image then video) then it throws error like "Cannot read property 'file' of undefined"

When i upload image or video very first time then it works.

My current code: flow.on('filesSubmitted', function (file) { if (file[0].file.type.toLowerCase().indexOf("video") >= 0){ $('#videoProcessingModal').modal('show'); } else { $('#processingModal').modal('show'); } $('.modal-scrollable').css('zIndex', 65538); $('.modal-backdrop').css('zIndex', 65537); flow.upload(); });

Error: training.bundle.js:24760 Uncaught TypeError: Cannot read property 'file' of undefined at Flow. (training.bundle.js:24760) at Flow. (flow.js:208) at each (flow.js:1573) at Flow.fire (flow.js:207) at Flow.addFiles (flow.js:597) at HTMLInputElement. (flow.js:412)

Hoping for quick response.

Thanks in advance.