Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizpicolo/6255a525b44de36e9684ed9e25b135c4 to your computer and use it in GitHub Desktop.
Save luizpicolo/6255a525b44de36e9684ed9e25b135c4 to your computer and use it in GitHub Desktop.
codigo_multer.js
const storage = multer.diskStorage({
destination: function(req, file, cb){
cb(null, 'public/uploads/');
},
filename: function(req, file, cb){
cb(null, `${file.filename}-${Date.now()}.${path.extname(file.originalname)}`);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment