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

76
Vistas
Sending image and additional info via HTTP

I want to send and image AND other text information, I saw that for the image I need to use enctype="multipart/form-data" in the form. But doing this make me unable to see the other information needed.

 <form action="/new" enctype="multipart/form-data" method="post">
      <input type="text" id="name" value=""/>
      <input type="file" name="image" accept="image/*"  value="Compagny Logo"/>
      <input type="submit" value="Load compagny"/>
</form>

var storage = multer.diskStorage({
    destination: (req, file, callBack) => {
        callBack(null, './public/images/')
    },
    filename: (req, file, callBack) => {
        callBack(null, file.fieldname + '-' + Date.now() + path.extname(file.originalname))
    }
})
 
var upload = multer({
    storage: storage
});

router.post("/new", upload.single('image'), (req, res) => {
        console.log(req.file.filename) // work
        console.log(req.name) // does'nt work
    }
});

Is there and other enctype I need to use ?

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