1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
21 .\" **************************************************************************
23 .TH CURLOPT_HTTPPOST 3 "September 02, 2017" "libcurl 7.59.0" "curl_easy_setopt options"
26 CURLOPT_HTTPPOST \- specify the multipart formpost content
29 #include <curl/curl.h>
31 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
32 struct curl_httppost *formpost);
34 Tells libcurl you want a multipart/formdata HTTP POST to be made and you
35 instruct what data to pass on to the server in the \fIformpost\fP argument.
36 Pass a pointer to a linked list of curl_httppost structs as parameter. The
37 easiest way to create such a list, is to use \fIcurl_formadd(3)\fP as
38 documented. The data in this list must remain intact as long as the curl
39 transfer is alive and is using it.
41 Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header.
42 You can disable this header with \fICURLOPT_HTTPHEADER(3)\fP.
44 When setting \fICURLOPT_HTTPPOST(3)\fP, it will automatically set
45 \fICURLOPT_NOBODY(3)\fP to 0.
47 This option is deprecated! Do not use it. Use \fICURLOPT_MIMEPOST(3)\fP
48 instead after having prepared mime data.
55 /* Fill in the file upload field. This makes libcurl load data from
56 the given file name when curl_easy_perform() is called. */
57 curl_formadd(&formpost,
59 CURLFORM_COPYNAME, "sendfile",
60 CURLFORM_FILE, "postit2.c",
63 /* Fill in the filename field */
64 curl_formadd(&formpost,
66 CURLFORM_COPYNAME, "filename",
67 CURLFORM_COPYCONTENTS, "postit2.c",
70 /* Fill in the submit field too, even if this is rarely needed */
71 curl_formadd(&formpost,
73 CURLFORM_COPYNAME, "submit",
74 CURLFORM_COPYCONTENTS, "send",
78 As long as HTTP is enabled. Deprecated in 7.56.0.
80 Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
82 .BR CURLOPT_POSTFIELDS "(3), " CURLOPT_POST "(3), " CURLOPT_MIMEPOST "(3),"
83 .BR curl_formadd "(3), " curl_formfree "(3), " curl_mime_init "(3)"