Created
January 15, 2020 17:07
-
-
Save picpoint/a735f05818bad9ad636dc53b266cc4d9 to your computer and use it in GitHub Desktop.
read and output file on page
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
let inFile = document.querySelector('#inFile'); | |
let outFile = document.querySelector('#outFile'); | |
let fileReader = new FileReader(); | |
fileReader.addEventListener('load', () => { | |
outFile.src = fileReader.result; | |
}); | |
inFile.addEventListener('change', (e) => { | |
let file = e.target.files[0]; | |
console.log(file); | |
fileReader.readAsDataURL(file); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment