1curl_mime_data(3)               libcurl Manual               curl_mime_data(3)
2
3
4

NAME

6       curl_mime_data - set a mime part's body data from memory
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_mime_data(curl_mimepart  *  part,  const  char  * data ,
12       size_t datasize);
13

DESCRIPTION

15       curl_mime_data(3) sets a mime part's body content from memory data.
16
17       data points to the data bytes: those are copied to the part  and  their
18       storage  may  safely  be  reused after call.  datasize is the number of
19       data bytes: it can be set to CURL_ZERO_TERMINATED to indicate data is a
20       null-terminated  character  string.   part is the part's to assign con‐
21       tents to.
22
23       Setting a part's contents twice is valid: only the  value  set  by  the
24       last  call  is  retained. It is possible to unassign part's contents by
25       setting data to NULL.
26
27       Setting very large data is memory consuming: one might  consider  using
28       curl_mime_data_cb(3) in such a case.
29

AVAILABILITY

31       As  long  as  at  least  one of HTTP, SMTP or IMAP is enabled. Added in
32       7.56.0.
33

RETURN VALUE

35       CURLE_OK or a CURL error code upon failure.
36

EXAMPLE

38        curl_mime *mime;
39        curl_mimepart *part;
40
41        /* create a mime handle */
42        mime = curl_mime_init(easy);
43
44        /* add a part */
45        part = curl_mime_addpart(mime);
46
47        /* add data to the part  */
48        curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
49

SEE ALSO

51       curl_mime_addpart(3),     curl_mime_data_cb(3),      curl_mime_name(3),
52       curl_mime_type(3)
53
54
55
56libcurl 7.79.1                 November 04, 2020             curl_mime_data(3)
Impressum