各位大佬,在使用multer的array方式进行批量图片上传时,只要超过三张图片,上传的图片就会有丢失,比如选择5张图片上传,最后只上传了2-3张,随机的,无法全部上传到指定的文件夹下,也没有报错信息,请问有人遇到这种情况?是什么问题?,代码如下: upload.js: let storage = multer.diskStorage({ destination: (req, file , cb) => { if(typeof file != 'undefined'){ let path = './static/upload/avator' if(req.url == '/api/article/release'){ path = './static/upload/article' } cb(null, path) } }, filename: function (req, file, cb) { let fileFormat = (file.originalname).split('.') cb(null, file.fieldname + '-' + Date.now() + '.' + fileFormat[fileFormat.length - 1]) } }) let upload = multer({ storage: storage }) module.exports = upload
const upload = require('../utils/upload') const A = require('../controller/article.js') router.post('/article/release', checkToken, upload.array('file', 20), A.release)
实在找不到问题所在,请各位大佬指点迷津,多谢。。。