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

143
Vistas
Wrong file size in File Object on iOS

I'm checking the file size of the files added via the <input /> html element in my Nextjs project.

It's working pretty fine on desktop. But now I've tested it on mobile (iOS) and the internal file picker of the iOS is previewing a different file size than the file[0].size object in JavaScript.

Background is, that I'm not uploading files bigger than 5MB to the server (Vercel has a strict 5MB payload limit) - so I'm testing for file[0].size < maxFileSize.

If I'm selecting a 6,7MB picture on my phone, the file[0].size is 4856162 (and not 6,7x1024x1024 = 7025459) and therefore below my 5242880 limit. But the server is now throwing errors, because the payload is above 5MB.

Are there any possibilities to get the "true" file size of iOS images in JS?

EDIT:

Screenshot of the iOS file browser, which shows that this image has for example 7,1MB enter image description here

Screenshot of the safari log on iOS, which shows the logged file.size and the maxFileSize: enter image description here

@brc-dd: Thanks for your suggestion, for now I'll just catch the 413 response from the server - but this is nonetheless a strange behaviour

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