Hi I want to display uploaded image in html using javascript.How i can to it.
Ankur Rajput
Asked 17-12-2024
223
Answer (1)
Here is the code.
function showImg(input) {
if (input.files && input.files[0]) {
var reader = new FileReader(); reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result)
.width(150)
.height(200);
}; reader.readAsDataURL(input.files[0]);
}
}