I have a workaround for the adding proper extension of files. If you use path
node module
var multer = require('multer');
var path = require('path')
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/')
},
filename: function (req, file, cb) {
cb(null, Date.now() + path.extname(file.originalname)) //Appending extension
}
})
var upload = multer({ storage: storage });
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…