Skip to content

Instantly share code, notes, and snippets.

@xu33
Created September 4, 2013 06:05
Show Gist options
  • Save xu33/6433256 to your computer and use it in GitHub Desktop.
Save xu33/6433256 to your computer and use it in GitHub Desktop.
read image from upload
function view() {
var f = document.getElementById("file").files[0];
var reader = new FileReader();
reader.onload = (function(evt) { //evt get all value
document.getElementById('div').innerHTML =
"PIC :<img src=" +
evt.target.result + "/>" ;
});
reader.readAsDataURL(f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment