how to send attachment as form data with http post call

Hi All,

Please let me know how can we use the http post call to send attachment as form data to end system.

Thanks in advance

Monica

Multipart form-data is used to send multiple attachments of different types in single post request.
Below are the steps

in http headers create 2 parameters
1 Content-Type: multipart/form-data;
2.boundary=---------------------------TESTBOUNDRY

encode your file image or pdf which you want to send and map to bytes
and in args you can create below 4 paraments
Content-Disposition: form-data;
name=“file1”;
filename=“a.jpeg”
Content-Type: image/jpeg

info:
---------------------------TESTBOUNDRY ;begining of the boundry
---------------------------TESTBOUNDRY-- ;ending of the boundry

your http post request should look like this when you extend the logs.

POST / HTTP/1.1
Host: localhost:5555
Content-Type: multipart/form-data; boundary=---------------------------TESTBOUNDRY
Content-Length: 554

-----------------------------TESTBOUNDRY
Content-Disposition: form-data; name=“file1”; filename=“a.jpeg”
Content-Type: image/jpeg

zfuzf8767432841kg95176985$%$§dsf$§"%72

-----------------------------TESTBOUNDRY–