Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

85
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!