Hi!
I want to notify users when they try to upload the same file twice. As far as I understand, if this is done during the same session, Uppy detects it natively but doesn’t show a message.
I defined this Uppy object:
const uppy = new Uppy({
onBeforeFileAdded(file, files) {
var match = Object.hasOwn(files, file.id);
console.log('match', match);
if (match) {
uppy.info(
`File "${file.name}" already uploaded`, 'error', 2000
);
}
return !match;
},
debug: true,
});
But this function is not working as expected. Note that it is mostly identical to the default function: (files, file) => !Object.hasOwn(files, file.id)
. The variable match
is always False
no matter if the file was previously uploaded during that session, reason why no info is showed to the user.