1CURLOPT_INFILESIZE(3) curl_easy_setopt options CURLOPT_INFILESIZE(3)
2
3
4
6 CURLOPT_INFILESIZE - set size of the input file to send off
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE, long file‐
12 size);
13
15 When uploading a file to a remote site, filesize should be used to tell
16 libcurl what the expected size of the input file is. This value must be
17 passed as a long. See also CURLOPT_INFILESIZE_LARGE(3) for sending
18 files larger than 2GB.
19
20 For uploading using SCP, this option or CURLOPT_INFILESIZE_LARGE(3) is
21 mandatory.
22
23 To unset this value again, set it to -1.
24
25 When sending emails using SMTP, this command can be used to specify the
26 optional SIZE parameter for the MAIL FROM command.
27
28 This option does not limit how much data libcurl will actually send, as
29 that is controlled entirely by what the read callback returns, but
30 telling one value and sending a different amount may lead to errors.
31
33 Unset
34
36 Many
37
39 CURL *curl = curl_easy_init();
40 if(curl) {
41 long uploadsize = FILE_SIZE;
42
43 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
44
45 curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
46
47 curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);
48
49 curl_easy_perform(curl);
50 }
51
53 SMTP support added in 7.23.0
54
56 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
57 if not.
58
60 CURLOPT_INFILESIZE_LARGE(3), CURLOPT_UPLOAD(3),
61
62
63
64libcurl 7.71.1 March 23, 2020 CURLOPT_INFILESIZE(3)