showing results for - "change destination of file multer"
Lena
10 Jan 2017
1var multer      = require('multer');
2var upload      = multer({ dest: 'public/uploads/teacher/' }).single('avatar');
3
4uploadAvatar: function(req, res) {
5    upload(req, res, function(err) {
6        console.log(req.body);
7        console.log(req.file);
8
9        if(err) {
10            return res.end("Error uploading file.");
11        }
12        res.end("File is uploaded");
13    });
14}