• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_mime_name
5Section: 3
6Source: libcurl
7See-also:
8  - curl_mime_addpart (3)
9  - curl_mime_data (3)
10  - curl_mime_type (3)
11---
12
13# NAME
14
15curl_mime_name - set a mime part's name
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_mime_name(curl_mimepart *part, const char *name);
23~~~
24
25# DESCRIPTION
26
27curl_mime_name(3) sets a mime part's name. This is the way HTTP form
28fields are named.
29
30*part* is the part's handle to assign a name to.
31
32*name* points to the null-terminated name string.
33
34The name string is copied into the part, thus the associated storage may
35safely be released or reused after call. Setting a part's name multiple times
36is valid: only the value set by the last call is retained. It is possible to
37reset the name of a part by setting *name* to NULL.
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  curl_mime *mime;
45  curl_mimepart *part;
46
47  CURL *curl = curl_easy_init();
48  if(curl) {
49    /* create a mime handle */
50    mime = curl_mime_init(curl);
51
52    /* add a part */
53    part = curl_mime_addpart(mime);
54
55    /* give the part a name */
56    curl_mime_name(part, "shoe_size");
57  }
58}
59~~~
60
61# AVAILABILITY
62
63As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0.
64
65# RETURN VALUE
66
67CURLE_OK or a CURL error code upon failure.
68