Created
September 9, 2014 09:14
-
-
Save pcoady/cd00a13c13a6a2c6e14c to your computer and use it in GitHub Desktop.
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
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 | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The blog for this code is now maintained at http://blog.backspace.academy