Skip to content

Instantly share code, notes, and snippets.

@pcoady
Created September 9, 2014 09:14
Show Gist options
  • Save pcoady/cd00a13c13a6a2c6e14c to your computer and use it in GitHub Desktop.
Save pcoady/cd00a13c13a6a2c6e14c to your computer and use it in GitHub Desktop.
function createS3(){
var bucket = new AWS.S3({
params: {
Bucket: 'backspace-cognito-test'
}
});
//Object key will be facebook-USERID#/FILE_NAME
var objKey = 'facebook-'+FACEBOOK_USER.id+'/test.txt';
var params = {
Key: objKey,
ContentType: 'text/plain',
Body: "Hello!",
ACL: 'public-read'
};
bucket.putObject(params, function (err, data) {
if (err) {
errorMessage += 'putObject: ' + err + "_____";
$('#errorConsole').text(errorMessage); // an error occurred
} else {
message += "Successfully uploaded data to your S3 bucket" + "_____";
$('#appConsole').text(message); // successful response
}
});
}
@pcoady
Copy link
Author

pcoady commented Apr 3, 2015

The blog for this code is now maintained at http://blog.backspace.academy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment