I trying to understand how to re-open a dialog after it was closed. Because if the user closed the dialog and doesn’t click add - the uploaded images are gone. I don’t see anywhere in docs to make the dialog show or reappear once its initialized. Or I could also bypass the “Done” button and just have the uploads added immediately after upload. Seems like an extra unnecessary step. Any help is greatly appreciated
Hi @Michael_Connors, let me suggest another solution. You can use the dialog’s fileColl API to save uploaded files on the go even if the user hasn’t clicked Add
let files = [];
function openDialog() {
// Create a new dialog instance
const dialog = uploadcare.openDialog(files, "", {
multiple: true
});
// Save uploaded files to `files` array
dialog.fileColl.onAdd.add((file) => {
files.push(file);
});
// User clicks Add. Handle dialog.done
dialog.done((group) => {
// If user clicks Add, we clear the `files` array
files = [];
group.files().forEach((file) => {
file.done(({ cdnUrl }) => {
console.log(cdnUrl);
});
});
});
}