When the lib receives files and fields, it starts to receive (upload) files in any case.
For example, I check form fields for emptiness, and reject the request. But it still accepts the files and stores them, and I can't prevent it.
form.on("field", function (name, value) {
// Reject if a form field value is empty
if (_.isEmpty(value)) {
return res.sendStatus(400);
// Want to cancel processing of the form here, but the lib continues
}
});
form.on("file", function (name, value) {
// And accepts the file, stores it, and reaches here
});
So in this example, if the received form consists of an empty field, and a file, its not possible to stop the file from being accepted (correct me if I've mistaken).
When the lib receives files and fields, it starts to receive (upload) files in any case.
For example, I check form fields for emptiness, and reject the request. But it still accepts the files and stores them, and I can't prevent it.
So in this example, if the received form consists of an empty field, and a file, its not possible to stop the file from being accepted (correct me if I've mistaken).