Created
January 2, 2020 06:59
-
-
Save gjp0609/b908b788c51962e9b5b6b306ec10d679 to your computer and use it in GitHub Desktop.
read text from file
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
<input id="file" type="file"/> | |
<script> | |
let input = document.getElementById("file"); | |
input.addEventListener("change", function () { | |
if (this.files && this.files[0]) { | |
let myFile = this.files[0]; | |
let reader = new FileReader(); | |
reader.addEventListener('load', function (e) { | |
console.log(e.target.result); | |
}); | |
reader.readAsBinaryString(myFile); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment