Last active
February 4, 2022 18:01
-
-
Save jsstoni/0f4bd2ed6d0ed77e47d7c05757334844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Image guardada: localStorage.image; | |
// crear un evento onchange al tipo file del formulario o cuando hagas tu submit ejecutar lo siguiente | |
var file = fileInput.files[0]; | |
var reader = new FileReader(); | |
reader.onload = function(e) { | |
localStorage.imagen = reader.result; | |
} | |
reader.readAsDataURL(file); |
This file contains hidden or 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
var img = new Image(); | |
img.src = localStorage.imagen; | |
document.getElementById("dondevaimagen").innerHTML = img; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment