1CURLOPT_INFILESIZE(3)      curl_easy_setopt options      CURLOPT_INFILESIZE(3)
2
3
4

NAME

6       CURLOPT_INFILESIZE - size of the input file to send off
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE, long filesize);
12

DESCRIPTION

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

DEFAULT

32       Unset
33

PROTOCOLS

35       Many
36

EXAMPLE

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

AVAILABILITY

52       SMTP support added in 7.23.0
53

RETURN VALUE

55       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
56       if not.
57

SEE ALSO

59       CURLOPT_INFILESIZE_LARGE(3), CURLOPT_UPLOAD(3),
60
61
62
63libcurl 7.85.0                   May 17, 2022            CURLOPT_INFILESIZE(3)
Impressum