我想知道该混合器的maxCount是否运作良好

时间:2019-01-22 11:36:40

标签: node.js express multer

我实现了multer来上传多个文件。但是,如果您上传的文件超出了maxCount,则multer不会显示错误。我想知道我是否能得到一个错误。请让我知道这个问题。

var cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 
'gallery', maxCount: 8 }])
app.post('/cool-profile', cpUpload, function (req, res, next) {
// req.files is an object (String -> Array) where fieldname is the key, and 
the value is array of files
//
// e.g.
//  req.files['avatar'][0] -> File
//  req.files['gallery'] -> Array
//
// req.body will contain the text fields, if there were any
 })

0 个答案:

没有答案