HTTP POST Request for Image Upload

This code snippet illustrates an HTTP POST request to upload an image along with a description and username using multipart/form-data. The request includes headers for the host, content length, and content type. The body of the request contains the binary data of the image and associated text data.
 avatar
unknown
plain_text
10 months ago
720 B
5
Indexable
POST /images HTTP/1.1  
Host: normal-website.com  
Content-Length: 12345  
Content-Type: multipart/form-data; boundary=---------------------------012345678901234567890123456  

---------------------------012345678901234567890123456  
Content-Disposition: form-data; name="image"; filename="example.jpg"  
Content-Type: image/jpeg  

[...nội dung nhị phân của example.jpg...]  

---------------------------012345678901234567890123456  
Content-Disposition: form-data; name="description"  

This is an interesting description of my image.  

---------------------------012345678901234567890123456  
Content-Disposition: form-data; name="username"  

wiener  
---------------------------012345678901234567890123456--
Editor is loading...
Leave a Comment