Last active
August 31, 2017 17:06
-
-
Save kolipass/c353e829af56f0c61d214200c719a1d2 to your computer and use it in GitHub Desktop.
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
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<body> | |
<input type="file" id="theFile" /> | |
<image id="myimage" /> | |
<script type="text/javascript"> | |
document.getElementById('theFile').addEventListener('change', example); | |
function example(evt) { | |
var files = evt.target.files; | |
f= files[0]; | |
//.... the user has choosen an image file | |
var reader = new FileReader(); | |
reader.onload = function(evt) { | |
document.getElementById('myimage').src=evt.target.result; | |
}; | |
reader.readAsDataURL(f); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment