Last active
April 3, 2016 03:44
-
-
Save jimmycann/3505ab7ee5b2ea46f62c1ae8ce54a416 to your computer and use it in GitHub Desktop.
Angular Tinify S3 - Upload Backend Pt.1
This file contains 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
var storage = multer.diskStorage({ //multers disk storage settings | |
destination: function (req, file, cb) { | |
cb(null, './app/uploads/') | |
}, | |
filename: function (req, file, cb) { | |
var datetimestamp = Date.now(); | |
var originalname = file.originalname.split('.'); | |
var new_filename = originalname[0] + '-' + datetimestamp + '.' + originalname[1]; | |
cb(null, new_filename) | |
} | |
}); | |
var upload = multer({ //multer settings | |
storage: storage | |
}).single('file'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment