Skip to content

Instantly share code, notes, and snippets.

@abishekrsrikaanth
Created April 14, 2014 13:18
Show Gist options
  • Save abishekrsrikaanth/10647012 to your computer and use it in GitHub Desktop.
Save abishekrsrikaanth/10647012 to your computer and use it in GitHub Desktop.
var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: '{my_access_id}', secretAccessKey: '{my_secret_key}'});
var s3 = new AWS.S3();
var params = {
Bucket: 'bucket_name',
Key: key,
ACL: 'public-read',
Body: file_name
};
//This doesn't work
var request = s3.putObject(params, function (err, data) {
//Do something after the file is uploaded
};
//This works
var request = s3.client.putObject(params, function (err, data) {
//Do something after the file is uploaded
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment