Skip to content

Instantly share code, notes, and snippets.

@igotit-anything
Last active August 26, 2016 17:49
Show Gist options
  • Save igotit-anything/90ea1095c785a41dd8409bd92d86c6f7 to your computer and use it in GitHub Desktop.
Save igotit-anything/90ea1095c785a41dd8409bd92d86c6f7 to your computer and use it in GitHub Desktop.
JavaScript. Local Image Show
<script>
var loadFile = function(event) {
var output = document.getElementById('id_viewimg');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>
<input type="file" onchange="loadFile(event)"/>
<img id="id_viewimg" src="images/photo.gif" name="preview" border="0" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment