Created
January 3, 2020 01:39
-
-
Save hadrysmateusz/f1d850e260ac4c9d431ff6865c94c7ca to your computer and use it in GitHub Desktop.
Markdium-Files in Client-Side JS: Ultimate Guide to Using Files in Web Applications
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
// get a reference to the inputElement in any way you choose | |
const inputElement = document.getElementById("inputElement") | |
// get the value once | |
inputElement.files[0] | |
// get the value every time the user selects a new file | |
inputElement.addEventListener("change", (e) => { | |
// e.target points to the input element | |
const selectedFile = e.target.files[0] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment