Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda