multer change path by request code example
Example: change destination of file multer
var multer = require('multer');
var upload = multer({ dest: 'public/uploads/teacher/' }).single('avatar');
uploadAvatar: function(req, res) {
upload(req, res, function(err) {
console.log(req.body);
console.log(req.file);
if(err) {
return res.end("Error uploading file.");
}
res.end("File is uploaded");
});
}