Skip to content

Instantly share code, notes, and snippets.

@BumbuKhan BumbuKhan/ExpressJS
Created Jul 26, 2017

Embed
What would you like to do?
ExpressJS file upload
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, './uploads/')
},
filename: function (req, file, cb) {
crypto.pseudoRandomBytes(16, function (err, raw) {
cb(null, raw.toString('hex') + Date.now() + '.' + mime.extension(file.mimetype));
});
}
});
var upload = multer({ storage: storage });
@BumbuKhan

This comment has been minimized.

Copy link
Owner Author

BumbuKhan commented Jul 26, 2017

Read more here expressjs/multer#170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.