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