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

130
Views
Problema de carga del archivo de nodo

Recibo constantemente el mensaje impreso de "Falló la carga de archivos" cuando selecciono mi imagen y presiono cargar. Nunca va a la verdad..

Como puede ver, en realidad no estoy subiendo aquí. Solo probando los archivos req. ¿hay algún problema en mi router.post? Cualquier entrada sería apreciada.

 router.post('/upload', async (req, res) => { try { if(!req.files) { res.send({ status: false, message: 'No file uploaded' }); } else { res.send({ status: true, message: 'Files are uploaded', data: data }); } } catch (err) { res.status(500).send(err); } }) module.exports=router
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

¿Puede compartir su archivo de controlador y también está usando la función asíncrona pero no define esperar dentro de esa función, debe usar 'esperar' al ejecutar la función asíncrona?

about 4 years ago · Juan Pablo Isaza Report

0

aquí está el archivo del controlador AAmir

 let fs = require('fs'); let async = require('async'); function uploaddownFiles(connection, fromFolder, toFolder, sftpmethod) { return new Promise((resolve, reject) => { // Getting all file list in given folder of local machine let fileList = fs.readdirSync(fromFolder); // filter only files not folders fileList = fileList.filter(file => { if (file.includes('.')) return true; return false; }); console.log('Total files: ', fileList.length) if (!fileList.length) return reject('No file to send') connection.sftp(function (err, sftp) { if (err) return; async.eachOfSeries(fileList, (file, key, cb) => { let moveFrom = `${fromFolder}/${file}`; let moveTo = `${toFolder}/${file}`; if (sftpmethod=== 'put') sftp.fastPut(moveFrom, moveTo, {}, function (uploadError) { if (uploadError) return cb(uploadError); console.log("Successfully Uploaded", file); cb(); }); else if (sftpmethod === 'get') sftp.fastGet(moveFrom, moveTo, {}, function (uploadError) { if (uploadError) return cb(uploadError); console.log("Successfully Downloaded", file); cb(); }); }, function (err) { if (err) { console.log(err); return reject(err); } else { console.log('all files have been uploaded/downloaded'); return resolve(); } }) }); }); }

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