How to send multiple images with form data to API?

How to send multiple images with form data to API?

Actually i want to send branch of image with form data to the server

I have a function there user can upload a post with multiple image with data
like
title
category
and
5 images
how can i do that please help me guys
Any help would be highly appreciated
Thanks

You can try passing the base64 of image to your api like this on your payload,

{
   "title": "Lorem Ipsum",
   "category": "Category One",
   "images": [
     {
         "filename": "987654211",
         "data": "<base64 of image>"
     }
     ...
  ]
}
1 Like

Thanks for your response but how can i create this json array dynamically
please can you tell me .

The way I can solve this is, First I will create a form for title and category. And next I’ll add a button which leads to take picture from camera or gallery then after taking the picture I’ll save the base64 of image to an array. Then if your want another picture just click the button again and the process will repeat it. After doiing so you can create an object where you can put the form data and the images array together

1 Like

Yes i understand please could you send me your code . I request you.
Thanks

hi i am trying a similar problem . Can you please share what helped you . Not able to take image as input in forms .