AGF
0
Q:

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");
    });
}
0

New to Communities?

Join the community