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