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

247
Visualizações
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 à 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