1curl_mime_data(3) libcurl Manual curl_mime_data(3)
2
3
4
6 curl_mime_data - set a mime part's body data from memory
7
9 #include <curl/curl.h>
10
11 CURLcode curl_mime_data(curl_mimepart *part, const char *data,
12 size_t datasize);
13
15 curl_mime_data(3) sets a mime part's body content from memory data.
16
17 part is the mime part to assign contents to, created with curl_mime_ad‐
18 dpart(3).
19
20 data points to the data that gets copied by this function. The storage
21 may safely be reused after the call.
22
23 datasize is the number of bytes data points to. It can be set to
24 CURL_ZERO_TERMINATED to indicate data is a null-terminated character
25 string.
26
27 Setting a part's contents multiple times is valid: only the value set
28 by the last call is retained. It is possible to unassign part's con‐
29 tents by setting data to NULL.
30
31 Setting large data is memory consuming: one might consider using
32 curl_mime_data_cb(3) in such a case.
33
35 curl_mime *mime;
36 curl_mimepart *part;
37
38 /* create a mime handle */
39 mime = curl_mime_init(easy);
40
41 /* add a part */
42 part = curl_mime_addpart(mime);
43
44 /* add data to the part */
45 curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
46
48 As long as at least one of HTTP, SMTP or IMAP is enabled. Added in
49 7.56.0.
50
52 CURLE_OK or a CURL error code upon failure.
53
55 curl_mime_addpart(3), curl_mime_data_cb(3), curl_mime_name(3),
56 curl_mime_type(3)
57
58
59
60libcurl 8.0.1 January 02, 2023 curl_mime_data(3)