Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

244
Vistas
file.size of input type "file" not getting actual size of file on iOS

I'm trying to validate max file size of 5MB, and it works on PC, on android phones, but fails everytime i use an iPhone. If i try to upload a photo of 6MB from a iPhone, it passes the validation but fails later because of my <jsonSerialization maxJsonLength="5000000"></jsonSerialization> restriction, and returns "Message": "Maximum request length exceeded." as expected.

So i added these lines on my $('input[type=file]').change(function):

var tam = $(this).get(0).files[0].size;
tam = tam / 1024;
alert('File size with division:' + tam);

And i get the alert saying that the 6MB photo in question has less than 4MB (3425kb), the code continues and then i get Maximum request length exceeded error.

I'm using:

  1. asp.net Web Forms
  2. .NET framework 4.6
  3. bootstrap 4.6
  4. bs-custom-file-input (plugin recommended by bootstrap)

Like i said, i'm only getting this error on iPhones.

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda