Skip to content

Instantly share code, notes, and snippets.

@nelsondev19
Last active March 23, 2024 22:36
Show Gist options
  • Save nelsondev19/e38fa6ae612ee0ff4ba973d74e56657a to your computer and use it in GitHub Desktop.
Save nelsondev19/e38fa6ae612ee0ff4ba973d74e56657a to your computer and use it in GitHub Desktop.
const imageBinary = null
const changeImagenUpdate = (e) => {
e.preventDefault();
const imageSelected = e.target.files[0];
const reader = new FileReader();
reader.readAsDataURL(imageSelected);
reader.onload = e => {
e.preventDefault();
imageBinary = e.target.result
}
}
const imageEl = document.getElementById('imagenId')
imageEl.src = imageBinary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment