Javascript can not display jpg files of 4 MB or more. Is there any limitation?
html
<input type='file' id="imgInp" />
js
$("#imgInp").change(function() {
readURL(this);
});
function readURL(input) {
if (input.files && input.files[0]) { let reader = new FileReader(); reader.onload = function(e) { $('#blah').attr('src', e.target.result); }; reader.readAsDataURL(input.files[0]); }
}
Javascript can not display jpg files of 4 MB or more. Is there any limitation?
html
<input type='file' id="imgInp" />
<img id="blah" src="#" alt="your image" />
js
$("#imgInp").change(function() {
readURL(this);
});
function readURL(input) {
if (input.files && input.files[0]) {
let reader = new FileReader();
reader.onload = function(e) {
$('#blah').attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
Javascript can not display jpg files of 4 MB or more. Is there any limitation?
All Replies (1)
The example on this page works for me for 5MB jpg. I don't think there's any limitation of such a small size.