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, const char * file‐
12       name);
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 nul-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 twice is valid: only the value set by the last call is
28       retained.
29

AVAILABILITY

31       As  long  as  at  least  one of HTTP, SMTP or IMAP is enabled. Added in
32       7.56.0.
33

RETURN VALUE

35       CURLE_OK or a CURL error code upon failure.
36

EXAMPLE

38        curl_mime *mime;
39        curl_mimepart *part;
40
41        /* create a mime handle */
42        mime = curl_mime_init(easy);
43
44        /* add a part */
45        part = curl_mime_addpart(mime);
46
47        /* send image data from memory */
48        curl_mime_data(part, imagebuf, imagebuf_len);
49
50        /* set a file name to make it look like a file upload */
51        curl_mime_filename(part, "image.png");
52
53        /* set name */
54        curl_mime_name(part, "data");
55

SEE ALSO

57       curl_mime_addpart(3), curl_mime_filedata(3), curl_mime_data(3)
58
59
60
61libcurl 7.66.0                September 22, 2017         curl_mime_filename(3)
Impressum