1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
21 .\" **************************************************************************
22 .TH curl_mime_data 3 "September 22, 2017" "libcurl 7.59.0" "libcurl Manual"
25 curl_mime_data - set a mime part's body data from memory
27 .B #include <curl/curl.h>
29 .BI "CURLcode curl_mime_data(curl_mimepart * " part ", const char * " data
30 .BI ", size_t " datasize ");"
33 \fIcurl_mime_data(3)\fP sets a mime part's body content from memory data.
35 \fIdata\fP points to the data bytes: those are copied to the part and their
36 storage may safely be reused after call.
37 \fIdatasize\fP is the number of data bytes: it can be set to
38 \fICURL_ZERO_TERMINATED\fP to indicate \fIdata\fP is a nul-terminated
40 \fIpart\fP is the part's to assign contents to.
42 Setting a part's contents twice is valid: only the value set by the last call
43 is retained. It is possible to unassign part's contents by setting
46 Setting very large data is memory consuming: one might consider using
47 \fIcurl_mime_data_cb(3)\fP in such a case.
49 As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
51 CURLE_OK or a CURL error code upon failure.
57 /* create a mime handle */
58 mime = curl_mime_init(easy);
61 part = curl_mime_addpart(mime);
63 /* add data to the part */
64 curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
67 .BR curl_mime_addpart "(3),"
68 .BR curl_mime_data_cb "(3),"
69 .BR curl_mime_name "(3),"
70 .BR curl_mime_type "(3)"