📅  最后修改于: 2022-03-11 15:03:51.527000             🧑  作者: Mango
fileFilter: (req,file,callback) => {
const types = /png|jpg|jpeg|webp|gif|webp|svg/
const extName = types.test(path.extname(file.originalname).toLocaleLowerCase())
const mimetype = types.test(file.mimetype)
if(extName && mimetype){
callback(null,true)
} else{
cb(new Error("Only supported png,jpeg,jpg,gif,webp and svg format image"))
}
}