How to send body and multiple images to a rest API


#1

I’m building a phone app with ionic, and I have a photo array that the user takes or loads from the gallery, like this:

    this.camera.getPicture(options).then(imagePath =>  {
      this.imagen = imagePath;
      this.galeriaImg.push(this.imagen);
    })

Now, I want that when I do the post to the server, which is a rest API in nodeJS, I can send the body and the images array in the same petition. I’ve been trying to do it with FileTransfer, but I can only send the images one by one, and I can’t send a body with them. Does anyone know how this could be achieved? Thanks!


#2

make an array of images in the form of base64. then pass it in post data in API call.