Skip to content

Instantly share code, notes, and snippets.

@nurfarazi
Created March 3, 2016 09:35
Show Gist options
  • Save nurfarazi/ab0b9d41331211e0cd48 to your computer and use it in GitHub Desktop.
Save nurfarazi/ab0b9d41331211e0cd48 to your computer and use it in GitHub Desktop.
var storage = multer.diskStorage({
destination: function (req, file, callback) {
callback(null, './uploadssss');
},
filename: function (req, file, callback) {
callback(null, file.fieldname + '-' + Date.now() + '.jpeg')
},
});
app.post('/uploadssss', multer({
storage: storage
}).single('profile'), (req, res) => {
console.log(req.file);
res.status(204).end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment