mirror of
https://github.com/curl/curl.git
synced 2026-07-23 14:57:19 +03:00
CURLOPT_MIMEPOST.3: add an (inline) example
Reported-by: Jay Satiro Bug: https://github.com/curl/curl/pull/9637#issuecomment-1268070723 Closes #9649
This commit is contained in:
parent
14aa9b193c
commit
5299301a9b
1 changed files with 19 additions and 3 deletions
|
|
@ -43,9 +43,25 @@ extending the deprecated \fICURLOPT_HTTPPOST(3)\fP option.
|
|||
.SH PROTOCOLS
|
||||
HTTP, SMTP, IMAP.
|
||||
.SH EXAMPLE
|
||||
Using this option implies the use of several mime structure building
|
||||
functions: see https://curl.se/libcurl/c/smtp-mime.html for a complete
|
||||
example.
|
||||
.nf
|
||||
curl_mime *multipart = curl_mime_init(handle);
|
||||
curl_mimepart *part = curl_mime_addpart(multipart);
|
||||
curl_mime_name(part, "name");
|
||||
curl_mime_data(part, "daniel", CURL_ZERO_TERMINATED);
|
||||
part = curl_mime_addpart(multipart);
|
||||
curl_mime_name(part, "project");
|
||||
curl_mime_data(part, "curl", CURL_ZERO_TERMINATED);
|
||||
part = curl_mime_addpart(multipart);
|
||||
curl_mime_name(part, "logotype-image");
|
||||
curl_mime_filedata(part, "curl.png");
|
||||
|
||||
/* Set the form info */
|
||||
curl_easy_setopt(handle, CURLOPT_MIMEPOST, multipart);
|
||||
|
||||
curl_easy_perform(handle); /* post away! */
|
||||
|
||||
curl_mime_free(multipart); /* free the post data */
|
||||
.fi
|
||||
.SH AVAILABILITY
|
||||
Added in 7.56.0
|
||||
.SH RETURN VALUE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue