Hi all. I'm having an issue trying to upload multiple images to my page. I'm using Multer and Cloudinary. Since Cloudinary doesn't have a method for multiple uploads, I passed the array of images (previously extracted with Multer) through a forEach. Ok, the images are successfully uploaded to mi cloudinary container. The problem comes into the upload function, when I trie to push the secure url and the public id into req.body.product. If I console.log(req.body.product) outside the upload function, it returns name and price (data from the form) but nothing about the arrays of images an ids. But if I console.log it inside de upload function, it returns the complet object (name, price, and both arrays). Product.create is taking the object without the arrays so I get my images uploaded to Cloudinary but I can't push the urls into my database to use in the showpage. It seems to me there's a scope issue I'm overlooking, but I can't figure out. Sorry for the long text, I want to be specific enough. Multer and cloudinary are correctly configured, I'm being able to upload single images in another routes.
Thanks in advance
Please sign in to leave a comment.