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

270
Views
JavaScript FormData() access file body

I have an HTML form with a file upload input. The form data is stored in a FormData() object so I can send it to the server using AJAX.

What I'm trying to do is access the FormData() values so I can modify the file contents that appear in the request. I have been monitoring the requests in Web Developer Tools -> Network.

If I'm uploading a .txt file or image, I want to be able to read its content, modify it and append it to the FormData().

My code so far is able to show the File object but I have no clue how to access the contents.

for( var pair of myFormData.entries() ){

   /* pair[1] is the file object inside the FormData */
   console.log(pair[0], pair[1]);

}

Thank you.

about 4 years ago · Santiago Trujillo
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!