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

238
Views
Subir archivos VueJS al backend de NodeJS por axios

Me gustaría cargar un archivo en vuejs a mi servidor nodejs. Sin embargo, no puedo recibir mi archivo en el backend. Alguien podría ayudarme. He probado varias cosas pero sigo sin conseguirlo. Si alguien me puede ayudar se lo agradeceria mucho :-)

Código de la página de carga de VueJS

 <input id="input-file" name="input-file" type="file" ref="file" @change="newFile($event)"/> const formData = new FormData(); formData.append("file", document.getElementById("input-file")) const createUserResponse = await RequestManager.executePostRequest("/users/upload", formData, { headers: { 'Content-Type': 'multipart/form-data' } });

RequestManager ejecutarPostRequest Función

 static async executePostRequest(url: string, params: any, specialConfig?: AxiosRequestConfig) { const postToken = Utils.buildHmacSha256Signature(params); let headers: AxiosRequestHeaders = { "x-access-token": config.server.backendAccessToken, } if (RequestManager.token) { headers = { "x-access-token": config.server.backendAccessToken, "x-token-data": RequestManager.token, } } if (specialConfig && specialConfig.headers) { headers = Utils.mergeObjects(headers, specialConfig.headers) as AxiosRequestHeaders; } const instance = axios.create({ baseURL: config.server.host, headers: headers }); console.log(headers); const paramsPost = { data: params, token: postToken } return new Promise<any>((resolve, reject) => { instance .post(url, paramsPost) .then(response => { resolve(response.data); }) .catch(error => { reject(error); }); }); }

Nodo JS de back-end

 UserRouter.get("/upload", (req, res) => { console.log(req.files); res.send("ok"); });
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!