Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flayder/a782aba20b0eee681c11e566e61b51dc to your computer and use it in GitHub Desktop.
Save flayder/a782aba20b0eee681c11e566e61b51dc to your computer and use it in GitHub Desktop.
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function(){
readURL(this);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment