curl_mime. Create a multipart post and for each part in the data you set the name, the data and perhaps additional meta-data. A basic setup might look like this:
curl_formaddis the former API to build multi-part formposts with but we no longer recommend using that)
CURLOPT_UPLOAD), you set the size of the upload and you set the URL to the destination:
Transfer-Encoding: chunkedheader with CURLOPT_HTTPHEADER. For HTTP 1.0 you must provide the size before hand and for HTTP 2 and later, neither the size nor the extra header is needed.
Expect: 100-continueheader in some circumstances. This header offers the server a way to reject the transfer early and save the client from having to send a lot of data in vain before the server gets a chance to decline.
CURLOPT_UPLOADor if it is asked to do a HTTP POST for which the body size is either unknown or known to be larger than 1024 bytes.