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

102
Views
req.body devuelve un objeto vacío

Estoy tratando de cargar un archivo y noté que cuando coloco enctype="multipart/form-data" en el formulario, devuelve un objeto vacío, pero cuando lo elimino, funciona bien.

En mi app.js usé:

 const app = express(); app.use(express.urlencoded({extended: true})); app.use(express.json());

y en el controlador:

 const multer = require('multer'); const Grupos = mongoose.model('Grupos'); const shortid = require('shortid'); const configMulter = { sotrage: fileStorage = multer.diskStorage({ destination: (req, file, next) => { next(null, __dirname+'\\..\\public\\uploads\\grupos'); }, filename: (req, file, next) => { const extension = file.mimetype.split('/')[1]; next(null, `${shortid.generate()}.${extension}`); } }) } const upload = multer(configMulter).single('imagen'); exports.subirImagen = (req, res, next) => { upload(res, req, function(error) { if(errores){ console.log(error); } else{ next(); } }) }

¿Podría ser un problema de ejs? Hice proyectos muy similares con pug y manillar y funcionaron bien.

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!