1var multer = require('multer');
2var path = require('path')
3
4var storage = multer.diskStorage({
5 destination: function (req, file, cb) {
6 cb(null, 'uploads/')
7 },
8 filename: function (req, file, cb) {
9 cb(null, Date.now() + path.extname(file.originalname)) //Appending extension
10 }
11})
12
13var upload = multer({ storage: storage });