Answers for "change destination of file multer"

0

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");
    });
}
Posted by: Guest on June-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language