uploadcare / react-file-uploader

MIT License
8 stars 0 forks source link

how does uploading multiple files work? #51

Closed barbalex closed 1 day ago

barbalex commented 3 days ago

Question

The docs mention about the file-upload-success event:

Dispatched when a file upload is successfully finished. The OutputFileEntry instance is in success state

This returns information only on a single file.

What event can be used to know when multiple file uploads have finished and get all their data (uuid's)?

I have tried common-upload-success but that never even gets called.

I tried depending on file-upload-success but got weird results when sometimes not all uploads were registered, other times they were registered multiple times...

I am using "@uploadcare/react-uploader": "1.1.0"

nd0ut commented 3 days ago

Hi @barbalex,

The common-upload-success event should indeed be what you need, as it's designed to trigger when multiple files finish uploading. It’s unusual that it’s not being called - could you provide a MRE for us to take a look?

In the meantime, here’s a working example for reference: https://codesandbox.io/p/sandbox/3nsxtg

barbalex commented 2 days ago

I am not sure what is happening. It seems that there is a timing issue. Could it be that the events don't always happen in the right sequence? Or that common-upload-success sometimes happens to early?

By the way your codesanbox link does not work.

egordidenko commented 1 day ago

Hi @barbalex

We've made the link public. Try the link again.

barbalex commented 1 day ago

O.k., now it works.

I am hoping that it is now working for me. There were some weird issues that may have to do with timing i.e. events arriving in the wrong sequence.

Anyway: It would be nice if you either documented or had a concrete example of how to deal with multiple files uploaded simultaneously, while useing their informations to save a database-entry of the uploads (i.e. run an ansynchronous process for every file uploaded).

barbalex commented 1 day ago

closing as what seems to remain is only the wish for better docs.