Skip to content

Instantly share code, notes, and snippets.

@stevewaffles
Created December 2, 2014 22:40
Show Gist options
  • Save stevewaffles/51c44150255d4fd2383e to your computer and use it in GitHub Desktop.
Save stevewaffles/51c44150255d4fd2383e to your computer and use it in GitHub Desktop.
FilePicker upload to Acclaim
filepicker.setKey('Ar6ip0fB0RbyQ2LuJnyB4z');
filepicker.pickAndStore({services:['computer']}, {location:"S3"}, function(response) {
upload_finished(response);
});
function upload_finished(response) {
$.ajax({
url: '/media/add/780',
type: "POST",
cache: false,
dataType: 'json',
data:{
"data[name]": response[0].filename,
"data[key]": response[0].key,
"data[Media][filepicker_url]": response[0].url
}
}).done(function(data) {
$('#mediaArea').load($('#mediaIndex').attr('href'));
$(".alert").remove();
$(".projects").prepend('<div id="flashMessage" class="alert alert-success"><button type="button" class="close" data-dismiss="alert">&times;</button>Your videos have been uploaded successfully!</div>');
$('.main-container').trigger('fade-alert');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment