Closed devalp-pro closed 1 year ago
Behaves like Array.filter: Returning false will simply ignore the file and go to the next.
use form.emit('error') inside filter to make form.parse error (formData.emit('error') in your case)
I also recommend you to slugify ext as it is user input and may contain invalid characters
return `resume_${currentTimeStamp}${slugify(ext)}`;
Support plan
Context
What are you trying to achieve or the steps to reproduce?
When I attached a file as png or another type. The formidable filter option returns false. In this false case formidable.parse() method does not give the form error invalid file type. variable formError always return null or undefined even if filter is false.
What was the result you got?
formData.parse(req, (fromError, fields, files) => {})
fromError always return null or undefined even if formData filter option returns false.
What result did you expect?
fromError returns a valid file type filter error.