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

586
Visualizações
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
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