1CURLOPT_MIMEPOST(3)                 libcurl                CURLOPT_MIMEPOST(3)
2
3
4

NAME

6       CURLOPT_MIMEPOST - send data from mime structure
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       curl_mime *mime;
12
13       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIMEPOST, mime);
14

DESCRIPTION

16       Pass a mime handle previously obtained from curl_mime_init(3).
17
18       This setting is supported by the HTTP protocol to post forms and by the
19       SMTP and IMAP protocols to provide the email data to send/upload.
20
21       This option is the preferred way of posting an HTTP form, replacing and
22       extending the CURLOPT_HTTPPOST(3) option.
23
24       When  setting  CURLOPT_MIMEPOST(3)  to NULL, libcurl resets the request
25       type for HTTP to the default to disable the POST. Typically that  would
26       mean  it  is  reset  to  GET.  Instead you should set a desired request
27       method explicitly.
28

PROTOCOLS

30       HTTP, SMTP, IMAP.
31

EXAMPLE

33        curl_mime *multipart = curl_mime_init(handle);
34        curl_mimepart *part = curl_mime_addpart(multipart);
35        curl_mime_name(part, "name");
36        curl_mime_data(part, "daniel", CURL_ZERO_TERMINATED);
37        part = curl_mime_addpart(multipart);
38        curl_mime_name(part, "project");
39        curl_mime_data(part, "curl", CURL_ZERO_TERMINATED);
40        part = curl_mime_addpart(multipart);
41        curl_mime_name(part, "logotype-image");
42        curl_mime_filedata(part, "curl.png");
43
44        /* Set the form info */
45        curl_easy_setopt(handle, CURLOPT_MIMEPOST, multipart);
46
47        curl_easy_perform(handle); /* post away! */
48
49        curl_mime_free(multipart); /* free the post data */
50

AVAILABILITY

52       Added in 7.56.0
53

RETURN VALUE

55       This will return CURLE_OK.
56

SEE ALSO

58       curl_mime_init(3)
59
60
61
62ibcurl 8.2.1                     July 12, 2023             CURLOPT_MIMEPOST(3)
Impressum