Created
June 22, 2020 12:53
-
-
Save pavinduLakshan/a25ac94c5b3d3d381077cd309849cc22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const multer = require('multer'); | |
// Create a directory '/uploads' in your project root, Uploaded images are stored there. | |
var storage = multer.diskStorage({ | |
destination: function (req, file, cb) { | |
cb(null, 'uploads') | |
}, | |
filename: function (req, file, cb) { | |
cb(null, Date.now() + '-' +file.originalname ) | |
} | |
}) | |
var upload = multer({ storage : storage }).array('file'); | |
module.exports = upload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment