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

581
Views
How do make post request with Axios and sending the files data in `Files` rather than in the body content?

I'm looking at trying to write a JavaScript function to post data back to my API server with Axios. However, I need the file to be in the Files field of the request and not in the body.

let formData  = new FormData();
formData.append("files", acceptedFiles[0], 'image.jpeg');
let url = "https://webhook.site/39e22a22-7fe2-45e6-bf7b-ba406ea550cc"
let resp = await axios.post(url, formData,{
   headers: { 'content-type': 'multipart/form-data' }
});

Raw Content Received by webhook.site

------WebKitFormBoundaryu1izASXZlBjTDNFk
Content-Disposition: form-data; name="files"; filename="image.jpeg"
Content-Type: image/jpeg

enter image description here

But when I do it with something like Insomnia API client. I get no body and no content. But the file is in the Files part of the request.

enter image description here

How do I achieve the what Insomnia is doing?

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!