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

118
Views
Multer upload array handling response

How can we possibly accomplish this output or response from multer upload multiple file API?

This is my payload:

{
    "slides" : [
        {"_id":0,"text": "Description","src":"data:image/png;base64,iVBORw0KGgoAAAANSUh..."},
        {"_id":1,"text": "Description","src":"data:image/png;base64,oTFKRtWHWKeSGJGGIGJ..."}
    ] 
}

This is the multer upload files API

router.post('/', upload.array('slides'), async (req, res) => {
    const payload = req.body;
    console.log(payload);
    // const newPayload = new Upload({slides: payload});   
    // const newPayload = new Payload({
    //     slides: payload
    // })
    // try {
    //     await newPayload.save();
    //     res.status(200).json(newPayload);
    // } catch (error) {
    //     res.status(400).json({ message: error.message })
    // }
});

Then I want the response result to be...

result:
{
    "slides" : [
        {"_id":0,"text": "Description","src":"file path.."},
        {"_id":1,"text": "Description","src":"file path.."}
    ] 
}

I need your help guys just new to node.js and practice some of the possible scenarios we may go through. Thanks a lot in advance :)

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!