| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
.\" * |
| 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. |
| 13 |
.\" * |
| 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. |
| 17 |
.\" * |
| 18 |
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
.\" * KIND, either express or implied. |
| 20 |
.\" * |
| 21 |
.\" ************************************************************************** |
| 22 |
.TH curl_mime_data 3 "22 August 2017" "libcurl 7.56.0" "libcurl Manual" |
| 23 |
.SH NAME |
| 24 |
curl_mime_data - set a mime part's body data from memory |
| 25 |
.SH SYNOPSIS |
| 26 |
.B #include <curl/curl.h> |
| 27 |
.sp |
| 28 |
.BI "CURLcode curl_mime_data(curl_mimepart * " part ", const char * " data |
| 29 |
.BI ", size_t " datasize ");" |
| 30 |
.ad |
| 31 |
.SH DESCRIPTION |
| 32 |
\fIcurl_mime_data(3)\fP sets a mime part's body content from memory data. |
| 33 |
|
| 34 |
\fIdata\fP points to the data bytes: those are copied to the part and their |
| 35 |
storage may safely be reused after call. |
| 36 |
\fIdatasize\fP is the number of data bytes: it can be set to |
| 37 |
\fICURL_ZERO_TERMINATED\fP to indicate \fIdata\fP is a nul-terminated |
| 38 |
character string. |
| 39 |
\fIpart\fP is the part's to assign contents to. |
| 40 |
|
| 41 |
Setting a part's contents twice is valid: only the value set by the last call |
| 42 |
is retained. It is possible to unassign part's contents by setting |
| 43 |
\fIdata\fP to NULL. |
| 44 |
|
| 45 |
Setting very large data is memory consuming: one might consider using |
| 46 |
\fIcurl_mime_data_cb(3)\fP in such a case. |
| 47 |
.SH AVAILABILITY |
| 48 |
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. |
| 49 |
.SH RETURN VALUE |
| 50 |
CURLE_OK or a CURL error code upon failure. |
| 51 |
.SH EXAMPLE |
| 52 |
.nf |
| 53 |
curl_mime *mime; |
| 54 |
curl_mimepart *part; |
| 55 |
|
| 56 |
/* create a mime handle */ |
| 57 |
mime = curl_mime_init(easy); |
| 58 |
|
| 59 |
/* add a part */ |
| 60 |
part = curl_mime_addpart(mime); |
| 61 |
|
| 62 |
/* add data to the part */ |
| 63 |
curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED); |
| 64 |
.fi |
| 65 |
.SH "SEE ALSO" |
| 66 |
.BR curl_mime_addpart "(3)," |
| 67 |
.BR curl_mime_data_cb "(3)," |
| 68 |
.BR curl_mime_name "(3)," |
| 69 |
.BR curl_mime_type "(3)" |