Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

97
Vistas
How to upload files in separate folder from req.files in express multer in one request

I am working on a project that accepts 3 .jpg files from the request. I want 2 of them to be uploaded in a separate folder and the other file in a separate folder. If I use

upload.fields([{ name: 'nid_front', maxCount: 1 }, { name: 'nid_back', maxCount: 1 }])

it gives me an error

{
  err: MulterError: Unexpected field
      at wrappedFileFilter (D:\ontheway\node_modules\multer\index.js:40:19)
      at Busboy.<anonymous> (D:\ontheway\node_modules\multer\lib\make-middleware.js:114:7)
      at Busboy.emit (events.js:400:28)
      at Busboy.emit (D:\ontheway\node_modules\busboy\lib\main.js:38:33)
      at PartStream.<anonymous> (D:\ontheway\node_modules\busboy\lib\types\multipart.js:213:13)
      at PartStream.emit (events.js:400:28)
      at HeaderParser.<anonymous> (D:\ontheway\node_modules\dicer\lib\Dicer.js:51:16)
      at HeaderParser.emit (events.js:400:28)
      at HeaderParser._finish (D:\ontheway\node_modules\dicer\lib\HeaderParser.js:68:8)
      at SBMH.<anonymous> (D:\ontheway\node_modules\dicer\lib\HeaderParser.js:40:12) {
    code: 'LIMIT_UNEXPECTED_FILE',
    field: 'photo',
    storageErrors: []
  }
}

I want two of those my files to be uploaded separately and another field with the name photo to be uploaded in a separate folder.

How should I do that?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda