Last active
September 19, 2016 18:39
-
-
Save rdegges/d2a2469177bb3e58baebac5092759d4d to your computer and use it in GitHub Desktop.
express-stormpath-s3 file upload example
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
app.get('/upload', stormpath.loginRequired, (req, res, next) => { | |
// Note the 'public-read' ACL permission. | |
req.user.uploadFile('./some-file.txt', 'public-read', err => { | |
if (err) return next(err); | |
req.user.getCustomData((err, data) => { | |
if (err) return next(err); | |
res.send('file uploaded as ' + data.s3['package.json'].href); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment