Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / curl_mime_addpart.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, 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_addpart 3 "September 22, 2017" "libcurl 7.59.0" "libcurl Manual"
23
24 .SH NAME
25 curl_mime_addpart - append a new empty part to a mime structure
26 .SH SYNOPSIS
27 .B #include <curl/curl.h>
28 .sp
29 .BI "curl_mimepart * curl_mime_addpart(curl_mime * " mime ");"
30 .ad
31 .SH DESCRIPTION
32 \fIcurl_mime_addpart(3)\fP creates and appends a new empty part to the given
33 mime structure and returns a handle to it.  The returned part handle can
34 subsequently be populated using functions from the mime API.
35
36 \fImime\fP is the handle of the mime structure in which the new part must be
37 appended.
38 .SH AVAILABILITY
39 As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
40 .SH RETURN VALUE
41 A mime part structure handle, or NULL upon failure.
42 .SH EXAMPLE
43 .nf
44  curl_mime *mime;
45  curl_mimepart *part;
46
47  /* create a mime handle */
48  mime = curl_mime_init(easy);
49
50  /* add a part */
51  part = curl_mime_addpart(mime);
52
53  /* continue and set name + data to the part */
54  curl_mime_data(part, "This is the field data", CURL_ZERO_TERMINATED);
55  curl_mime_name(part, "data");
56 .fi
57 .SH "SEE ALSO"
58 .BR curl_mime_init "(3),"
59 .BR curl_mime_name "(3),"
60 .BR curl_mime_data "(3),"
61 .BR curl_mime_data_cb "(3),"
62 .BR curl_mime_filedata "(3),"
63 .BR curl_mime_filename "(3),"
64 .BR curl_mime_subparts "(3),"
65 .BR curl_mime_type "(3),"
66 .BR curl_mime_headers "(3),"
67 .BR curl_mime_encoder "(3)"