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

171
Vistas
Nodejs Send json data and images together to a route and store them in mongodb

I am trying to retrieve image file and json file together from a route and save all those information in MongoDB.

const petCheckoutDetails = new PetCheckoutDetails({
    id: Date.now(),
    name: req.body.name,
    age: req.body.age,
    image: imagefile,
    petType: req.query.petType,
    user: userid,
  })

I can get the json from req.body and store it in database but for image I cannot just save it with multer simultaneously. So I tried creating a route for image /upload. Now I can save image and json separately. I want to save in the given upper format. Is there a way I can do it or just save the image there and somehow point that this image belongs to specific user. Any help will be appreciated.

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