I am working with Nodejs and i am using express js,Right now i am trying to upload image using API,But right now i am getting following error
Route.post() requires a callback function but got a [object Undefined]
Here is my "api.router.js" file
const multer = require('multer')
router.post('/uploadimage', apiController.upload);
And here is my controller file(apicontroller) code
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, 'uploads/')
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
const upload = multer({ storage: storage })
Via Active questions tagged javascript - Stack Overflow https://ift.tt/7LWhoCQ
Comments
Post a Comment