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

244
Visualizações
How to send File to Nodejs server to another api server without storing the file?

I am trying to send a pdf file to my node server and when my node server get the request it will send the same file to another api server. I am not suppose to store the file in my nodejs server. Just take the file and pass it to api server. here is my implementation below,

export const uploadDocument = async ctx => {
  try {
    const { path, name, type } = ctx.request.files.document;
    const file = path + name;
    await documentUpload(file);
  } catch (error) {
     console.log(error);
  }
};

const documentUpload = async file => {
  try {
    let formData = new FormData();
    formData.append("document", file);
    const response = await axios.post(
      `${variables.recruitUrl}/upload_url`,
      formData,
      {
  headers: {
    "Content-Type": "multipart/form-data",
    Authorization: `Bearer 5dd872b44a.d6d2e2950b3ae3a9f8081369cd82c953`,
  },
};
    );
    console.log(response);
  } catch (error) {
    console.log(error);
  }
};

the error I am getting from the api server is 'the request was rejected because no multipart boundary was found', If I remove the content type multipart to nothing api server return extra param found.

about 4 years ago · Juan Pablo Isaza
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