Answer the question
In order to leave comments, you need to log in
Why is multer undefined?
Why is multer undefined?
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './pubic/uploads')
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
var upload = multer({
storage: storage
});
router.post('/create', upload.single('cover'), (req, res) => {
console.log(req.file)
})
Answer the question
In order to leave comments, you need to log in
Have you linked the library to the file?const multer = require('multer');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question