Created
April 9, 2015 17:04
-
-
Save jdcauley/9c7117a768566c341513 to your computer and use it in GitHub Desktop.
sisimple skipper 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
module.exports = { | |
new: function(req, res){ | |
var params = req.params.all(); | |
console.log(params); | |
req.file('file').upload({ | |
// ...any other options here... | |
adapter: require('skipper-s3'), | |
key: sails.config.secrets.aws.key, | |
secret: sails.config.secrets.aws.secret, | |
bucket: sails.config.secrets.aws.bucket | |
}, function(err, uploadedFiles){ | |
if (err) return res.json({error: err}); | |
if(uploadedFiles){ | |
res.json({ | |
message: uploadedFiles.length + ' file(s) uploaded successfully!', | |
files: uploadedFiles | |
}); | |
} | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment