Skip to content

Instantly share code, notes, and snippets.

@jimmylee
Last active May 24, 2016 22:16
Show Gist options
  • Save jimmylee/157911822a9b3958eed8093c00f4bb1a to your computer and use it in GitHub Desktop.
Save jimmylee/157911822a9b3958eed8093c00f4bb1a to your computer and use it in GitHub Desktop.
// STEP 1:
// I use a tool like Dropzone to get the JavaScript file object but I mean you
// can do whatever your heart desires. you're going to listen to the drop event.
// STEP 2:
// Have a method thats like a callback
_handleFilesDropped(files) {
if (files.length) {
const file = files[0];
return uploadFile(file);
}
}
// STEP(3): Then for each! do something like this:
uploadFile(file) {
const data = new FormData();
data.append("file", file, file.name);
// Make your $http request.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment