Sykje yn Support

Mij stipescams. Wy sille jo nea freegje in telefoannûmer te beljen, der in sms nei ta te stjoeren of persoanlike gegevens te dielen. Meld fertochte aktiviteit mei de opsje ‘Misbrûk melde’.

Mear ynfo

Dizze konversaasje is argivearre. Stel in nije fraach as jo help nedich hawwe.

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

  • 1 antwurd
  • 1 hat dit probleem
  • 1 werjefte
  • Lêste antwurd fan 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?

Alle antwurden (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.