2017-09-03 00:47:10 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\" * _ _ ____ _
|
|
|
|
.\" * Project ___| | | | _ \| |
|
|
|
|
.\" * / __| | | | |_) | |
|
|
|
|
.\" * | (__| |_| | _ <| |___
|
|
|
|
.\" * \___|\___/|_| \_\_____|
|
|
|
|
.\" *
|
2021-09-01 16:26:36 +08:00
|
|
|
.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2017-09-03 00:47:10 +08:00
|
|
|
.\" *
|
|
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
|
|
.\" * you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
.\" * are also available at https://curl.se/docs/copyright.html.
|
2017-09-03 00:47:10 +08:00
|
|
|
.\" *
|
|
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
.\" * KIND, either express or implied.
|
|
|
|
.\" *
|
|
|
|
.\" * SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
.\" *
|
2017-09-03 00:47:10 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\"
|
|
|
|
.TH CURLOPT_MIMEPOST 3 "22 Aug 2017" "libcurl 7.56.0" "curl_easy_setopt options"
|
|
|
|
.SH NAME
|
2021-09-09 04:55:58 +08:00
|
|
|
CURLOPT_MIMEPOST \- send data from mime structure
|
2017-09-03 00:47:10 +08:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
curl_mime *mime;
|
|
|
|
|
|
|
|
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIMEPOST, mime);
|
|
|
|
.SH DESCRIPTION
|
2017-09-04 15:20:24 +08:00
|
|
|
Pass a mime handle previously obtained from \fIcurl_mime_init(3)\fP.
|
2017-09-03 00:47:10 +08:00
|
|
|
|
|
|
|
This setting is supported by the HTTP protocol to post forms and by the
|
2021-12-17 18:02:18 +08:00
|
|
|
SMTP and IMAP protocols to provide the email data to send/upload.
|
2017-09-03 00:47:10 +08:00
|
|
|
|
2017-09-04 15:20:24 +08:00
|
|
|
This option is the preferred way of posting an HTTP form, replacing and
|
2022-10-12 22:43:31 +08:00
|
|
|
extending the \fICURLOPT_HTTPPOST(3)\fP option.
|
2017-09-03 00:47:10 +08:00
|
|
|
.SH PROTOCOLS
|
|
|
|
HTTP, SMTP, IMAP.
|
|
|
|
.SH EXAMPLE
|
2022-10-05 16:02:13 +08:00
|
|
|
.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
|
2021-09-01 16:26:36 +08:00
|
|
|
.SH AVAILABILITY
|
2021-10-27 17:45:26 +08:00
|
|
|
Added in 7.56.0
|
2021-09-01 16:26:36 +08:00
|
|
|
.SH RETURN VALUE
|
|
|
|
This will return CURLE_OK.
|
2017-09-03 00:47:10 +08:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR curl_mime_init "(3)"
|