How can I validate my field "key" before file will be uploaded?
But I don't find any information about this. I use express, multer.
var upload = multer({
storage: storage,
limits: limits,
fileFilter: fileFilter
}).fields([{ name: 'avatar', maxCount: 1 }, { name: 'key', maxCount: 1 }]);
router.post('/', (req, res) => {
upload(req, res, function (err) {
if (err) {
console.log(err);
// An error occurred when uploading
res.send({result: err.message});
}
res.send({result: "OK"});
});
});
via Dan
No comments:
Post a Comment