1curl_mime_filename(3)           libcurl Manual           curl_mime_filename(3)
2
3
4

NAME

6       curl_mime_filename - set a mime part's remote file name
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_mime_filename(curl_mimepart *part,
12                                   const char *filename);
13

DESCRIPTION

15       curl_mime_filename(3)  sets a mime part's remote file name. When remote
16       file name is set, content data is processed as a file, whatever is  the
17       part's  content source. A part's remote file name is transmitted to the
18       server in the associated Content-Disposition generated header.
19
20       part is the part's handle to assign the remote file name to.
21
22       filename points to the null-terminated file name string; it may be  set
23       to NULL to remove a previously attached remote file name.
24
25       The  remote  file name string is copied into the part, thus the associā€
26       ated storage may safely be released or reused  after  call.  Setting  a
27       part's  file  name  multiple  times is valid: only the value set by the
28       last call is retained.
29

EXAMPLE

31        curl_mime *mime;
32        curl_mimepart *part;
33
34        /* create a mime handle */
35        mime = curl_mime_init(easy);
36
37        /* add a part */
38        part = curl_mime_addpart(mime);
39
40        /* send image data from memory */
41        curl_mime_data(part, imagebuf, imagebuf_len);
42
43        /* set a file name to make it look like a file upload */
44        curl_mime_filename(part, "image.png");
45
46        /* set name */
47        curl_mime_name(part, "data");
48

AVAILABILITY

50       As long as at least one of HTTP, SMTP or  IMAP  is  enabled.  Added  in
51       7.56.0.
52

RETURN VALUE

54       CURLE_OK or a CURL error code upon failure.
55

SEE ALSO

57       curl_mime_addpart(3), curl_mime_filedata(3), curl_mime_data(3)
58
59
60
61libcurl 7.85.0                   May 17, 2022            curl_mime_filename(3)
Impressum