Skip to content

Instantly share code, notes, and snippets.

@gmac
Created September 10, 2018 12:24
Show Gist options
  • Save gmac/4f2517bebaabc0d385f48e7bb1330aa9 to your computer and use it in GitHub Desktop.
Save gmac/4f2517bebaabc0d385f48e7bb1330aa9 to your computer and use it in GitHub Desktop.
document.querySelector('#file-field').addEventListener('change', (evt) => {
uploader.then((evaporate) => {
Array.from(evt.target.files).forEach((file) => {
evaporate.add({
file,
name: file.name,
progress: (progressValue) => console.log('Progress', progressValue),
complete: (_xhr, awsKey) => console.log('Complete!', awsKey),
}).then(
(awsObjectKey) => console.log('File successfully uploaded to:', awsObjectKey),
(reason) => console.log('File did not upload sucessfully:', reason)
);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment