Created
July 22, 2019 12:32
-
-
Save h26k2/c7600a01139395717ae4e5ecf17f0399 to your computer and use it in GitHub Desktop.
Displays a picture LOCALLY when user uploads
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
/************************************************************** | |
* Displaying Picture when user uploads it (from the localhost) | |
***************************************************************/ | |
let tempProfilePicContainer = document.getElementById("reg--profile--pic"); | |
let reader = new FileReader(); | |
function showImage(that){ | |
reader.onload = function(event){ | |
tempProfilePicContainer.setAttribute("style","background-image:url('"+reader.result+"')"); | |
} | |
reader.readAsDataURL(event.target.files[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment