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

165
Views
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
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!