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

147
Views
extra info being added to image from input file in formData fetch request

Uploading image to S3 from typescript react client side but for some reason appending that file to formData adds extra info to the file (which corrupts it and can't be opened after downloading from S3). After removing that extra info from a text editor, the image opens fine. Anyone know why this is happening? I'm using fetch API with FormData

const onFileChange = (e: ChangeEvent<HTMLInputElement>) => {

    const formData = new FormData();
    if (e.target.files) {
      formData.append("file", e.target.files[0]);

      fetch(url, {
        method: "PUT",
        body: formData,
        headers: {
          "Content-Type": e.target.files[0].type,
        },
      })
        .then((response) => {
          console.log(response);
        })
        .catch((err) => {
          console.log(err);
        });
    }
  };

<input
    type="file"
    accept="image/*"
    name="photo"
     onChange={(e) => onFileChange(e)}
  />

enter image description here

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!