Pomoc přepytać

Hladajće so wobšudstwa pomocy. Njenamołwimy was ženje, telefonowe čisło zawołać, SMS pósłać abo wosobinske informacije přeradźić. Prošu zdźělće podhladnu aktiwitu z pomocu nastajenja „Znjewužiwanje zdźělić“.

Learn More

Javascript can not display jpg files of 4 MB or more. Is there any limitation?

  • 1 wotmołwa
  • 1 ma tutón problem
  • 1 napohlad
  • Poslednja wotmołwa wot TyDraniu

more options

html

       <input type='file' id="imgInp" />
       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?

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?

Wšě wotmołwy (1)

more options

The example on this page works for me for 5MB jpg. I don't think there's any limitation of such a small size.