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

84
Visualizações
Safari does not upload image files in body of PUT requests

PUT requests where the body is a file do not work in Safari (version 13.x). The same code works in Chrome and Firefox. I've tried using the Fetch API and Axios - neither work in Safari.

The File object being passed to the call can come from the drag-and-drop API or a simple file type input. Both of which work in Chrome / Firefox but neither in Safari.

While files sent with MIME type application/pdf work fine, it seems that anything with the image/ prefix or even octet-stream result in Safari not sending the body. According to the Safari developer panel, the body is 0 bytes.

The requests have the correct Content-Length and Content-Type headers. After a while, S3 replies with a message saying they haven't received any bytes in the last 20 seconds. The response is a 400 and the connection is closed.

UPDATE: As reported by Safari, the body is 0 bytes.

Code

           // filesToUpload is an array of File objects, and is 
           // correctly populated with appropriate file types and sizes
            var options = {
                headers: {
                    'Content-Type': filesToUpload[uploadIndex].type,
                }
            };
            await axios.put(url, filesToUpload[uploadIndex], options);

            // This does not work either
            await fetch(url, {
                method: "PUT",
                body: filesToUpload[uploadIndex]
            });

I'm aware of the bug in Safari 14.1 preventing file inputs from working, but this is not related. The file input works correctly here, as does the drag-and-drop API - at least from my perspective. I can see the correct file types and sizes in the filesToUpload array.

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