1CURLOPT_INFILESIZE(3)               libcurl              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       Using  CURLOPT_UPLOAD(3) to a HTTP/1.1 server and this value set to -1,
25       makes libcurl do a chunked transfer-encoded upload.
26
27       When sending emails using SMTP, this command can be used to specify the
28       optional SIZE parameter for the MAIL FROM command.
29
30       This option does not limit how much data libcurl will actually send, as
31       that is controlled entirely by what  the  read  callback  returns,  but
32       telling one value and sending a different amount may lead to errors.
33

DEFAULT

35       Unset
36

PROTOCOLS

38       Many
39

EXAMPLE

41       CURL *curl = curl_easy_init();
42       if(curl) {
43         long uploadsize = FILE_SIZE;
44
45         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");
46
47         curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
48
49         curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);
50
51         curl_easy_perform(curl);
52       }
53

AVAILABILITY

55       SMTP support added in 7.23.0
56

RETURN VALUE

58       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
59       if not.
60

SEE ALSO

62       CURLOPT_INFILESIZE_LARGE(3), CURLOPT_UPLOAD(3),
63
64
65
66ibcurl 8.2.1                     June 12, 2023           CURLOPT_INFILESIZE(3)
Impressum