Last active
May 24, 2016 22:16
-
-
Save jimmylee/157911822a9b3958eed8093c00f4bb1a to your computer and use it in GitHub Desktop.
This file contains 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
// 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