Asp. Net MVC
August 01, 2020
Select and display image(s) using FileReader using Jquery.
HTML CODE:
<input class="joint" type='file' id="imgInp" />
<img style="width:45px" id="blah" src="#" alt="your image" />
Jquery CODE:
<script type="text/javascript">
$("#imgInp").change(function()
{
readURL(this);
});
function readURL(input) {
if (input.filers && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
</script>