Skip to content

Instantly share code, notes, and snippets.

@stgoos
Forked from jacobtwlee/ReadFile.js
Created January 15, 2017 15:12
Show Gist options
  • Save stgoos/50e6e6d79ffcd93f1b598cdcef2a5c69 to your computer and use it in GitHub Desktop.
Save stgoos/50e6e6d79ffcd93f1b598cdcef2a5c69 to your computer and use it in GitHub Desktop.
Reading the file
function readFile(file) {
var reader = new FileReader();
reader.onloadend = function () {
processFile(reader.result, file.type);
}
reader.onerror = function () {
alert('There was an error reading the file!');
}
reader.readAsDataURL(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment