i want to check the real type of image file when i upload it using multer in nodejs. for example when i check the mimtype or ext of files, if the ext of uploaded photo changed from rar to jpeg. the server will accept the file but it shoudnt.could anyone help me with file filter?
var upload = multer({
storage: storage,
dest: "uploads/",
fileFilter: function (req, file, cb) {
if (
file.mimetype !== "image/png" &&
file.mimetype !== "image/gif" &&
file.mimetype !== "image/jpeg"
) {
return cb(null, false);
} else {
cb(null, true);
}
},
});