Open
Description
I'm having an issue:
In afterUpload
event I validate using mmmagic if file extension is correct if not I remove file
ImagesCollection.on('afterUpload', async file => {
const returnedFile = file;
await validateUploadedFile(file)
.catch(async error => {
await ImagesCollection.removeAsync(file._id);
returnedFile.error = error.message;
});
return returnedFile;
});
but on frontend in
uploader.on('end', (error, fileObj) => {
fileObj does not contain error property
it was working in previous releases(before 3.0) when we were using Future
ImagesCollection.on('afterUpload', function (file) {
const returnedFile = file;
const futureResult = new Future();
validateUploadedFile(file)
.then(() => {
futureResult.return(file);
})
.catch(error => {
this.remove(file._id);
returnedFile.error = error.message;
futureResult.return(file);
});
futureResult.wait();
});
Do you have any suggestion how to fix/implement this in 3.0.0-beta.6 version?
Activity
dr-dimitru commentedon Mar 24, 2025
@mcieslakcc
v3.0.0-beta.7
is out, please give it a try. If "event" won't work useonAfterUpload
function as option passed tonew FilesCollection
constructor. Let me know if it works for youdr-dimitru commentedon Mar 26, 2025
@mcieslakcc please try
ostrio:files@3.0.0-rc.2
a lot of things fixed and improved