Skip to content

Instantly share code, notes, and snippets.

@hadrysmateusz
Created January 3, 2020 01:39
Show Gist options
  • Save hadrysmateusz/f1d850e260ac4c9d431ff6865c94c7ca to your computer and use it in GitHub Desktop.
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
// 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