1CURLOPT_PUT(3) curl_easy_setopt options CURLOPT_PUT(3)
2
3
4
6 CURLOPT_PUT - make an HTTP PUT request
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PUT, long put);
12
14 A parameter set to 1 tells the library to use HTTP PUT to transfer
15 data. The data should be set with CURLOPT_READDATA(3) and CURLOPT_IN‐
16 FILESIZE(3).
17
18 This option is deprecated since version 7.12.1. Use CURLOPT_UPLOAD(3)!
19
21 0, disabled
22
24 HTTP
25
27 CURL *curl = curl_easy_init();
28 if(curl) {
29 /* we want to use our own read function */
30 curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
31
32 /* enable PUT */
33 curl_easy_setopt(curl, CURLOPT_PUT, 1L);
34
35 /* specify target */
36 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile");
37
38 /* now specify which pointer to pass to our callback */
39 curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
40
41 /* Set the size of the file to upload */
42 curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
43
44 /* Now run off and do what you have been told! */
45 curl_easy_perform(curl);
46 }
47
49 Deprecated since 7.12.1. Do not use.
50
52 Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
53
55 CURLOPT_UPLOAD(3), CURLOPT_HTTPGET(3),
56
57
58
59libcurl 7.82.0 November 26, 2021 CURLOPT_PUT(3)