I have multiple arrays of images: questionImg, optionImg, solutionImg respectively, each of which are an array of images. How to upload all the arrays of images using multer?
upload.array() takes only one array as an argument. How do we handle multiple arrays?
Also, if someone could tell me how can i upload 2-dimensional array of images, it would be really helpful.
I uploaded all the arrays of images using upload.any() . It handles any kind i.e. single image, array of images, or multiple arrays, or even image as a part of some json object.
After uploading all the files can be accessed using req.files object. You might have to play around with little bit. Look at req.files.fieldname and req.files.location
Most helpful comment
I uploaded all the arrays of images using
upload.any(). It handles any kind i.e. single image, array of images, or multiple arrays, or even image as a part of some json object.After uploading all the files can be accessed using
req.filesobject. You might have to play around with little bit. Look atreq.files.fieldnameandreq.files.location