Skip to content

Instantly share code, notes, and snippets.

@rexxars
Last active October 7, 2021 04:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rexxars/9111474 to your computer and use it in GitHub Desktop.
Save rexxars/9111474 to your computer and use it in GitHub Desktop.
Async.js + imboclient.js
var imbo = new Imbo.Client('host', 'pub', 'priv');
var fileInput = document.querySelector('input[type=file]');
fileInput.addEventListener('change', uploadFiles, false);
function uploadFiles() {
async.mapSeries(
fileInput.files,
imbo.addImage.bind(imbo),
onFilesUploaded
);
};
function onFilesUploaded(err, imageIdentifiers) {
if (err) {
return console.error('Failed to upload images!', err);
}
console.log(imageIdentifiers.map(imbo.getImageUrl.bind(imbo)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment