onUploading() event for dialog

is there an onUploading() event/method for when the user has selected a file, and the upload progress is happening? i assume there’s something which is happening that i can hook.

i can see dialog.progress(), but that seems to be called when the dialog opens, rather than when a file has been selected to upload and i can see widget.onChange() but that doesn’t seem to exist in the dialog API.

thanks!

oh! i found it:

const dialog = uploadcare.openDialog(null, "", imageuploader_opts);
       
dialog.done((file) => {
           
            file.progress((f)=>{
                // useful stuff in here!
            });
1 Like

Hi @thinkplaymake,

Good catch! You can also use dialog.fileColl interface to start tracking uploading progress right after a file is selected (it may be useful if you use multi-upload mode or have the preview step enabled)

const dialog = uploadcare.openDialog(null, "", imageuploader_opts);

// File added to the dialog
dialog.fileColl.onAdd.add(file => {
  file.progress(progressInfo => {
    // do stuff with progress info
  });

// File removed from the dialog
dialog.fileColl.onRemove.add(()=> {
  console.log("File removed");
});
1 Like

that’s great, thanks for sharing @Alex.
we’ve implemented uploadcare today on our project my.manualof.me to power user generated content uploads, and I’m so happy with it so far - thankyou for all the support to date.

1 Like

Thanks, @thinkplaymake, appreciate the feedback :heart_eyes: