How to upload multiple files using rest-client in vscode
Asked Answered
B

1

5

I have a post API call, which allows me to upload multiple images within form-data parameter in Postman. As you can see below, I'm sending multiple images having the key images

enter image description here

I wanna implement the same thing using the extension rest-client in vscode.

Boles answered 1/6, 2022 at 14:38 Comment(1)
B
6

Thanks to @Tomothy G.'s comment I found the solution, it looks like this:

### ---------------------------- UPLOAD FEED IMAGES ----------------------------
POST {{hostname}}/upload_feed_images
Authorization: {{token}}
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="images"; filename="my_image.jpg"
Content-Type: image/jpeg

< /Users/anel-bou/Desktop/my_image.jpg
--boundary
Content-Disposition: form-data; name="images"; filename="my_image.jpg"
Content-Type: image/jpeg

< /Users/anel-bou/Desktop/my_image.jpg
--boundary--
### -------------------------------------------------------------------------

the parameter name="images" stands for the key that the files should belong to

Boles answered 1/6, 2022 at 15:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.