1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_INFILESIZE_LARGE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_CONTENT_LENGTH_UPLOAD_T (3)
9  - CURLOPT_INFILESIZE (3)
10  - CURLOPT_UPLOAD (3)
11Protocol:
12  - All
13---
14
15# NAME
16
17CURLOPT_INFILESIZE_LARGE - size of the input file to send off
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE_LARGE,
25                          curl_off_t filesize);
26~~~
27
28# DESCRIPTION
29
30When uploading a file to a remote site, *filesize* should be used to tell
31libcurl what the expected size of the input file is. This value must be passed
32as a **curl_off_t**.
33
34For uploading using SCP, this option or CURLOPT_INFILESIZE(3) is
35mandatory.
36
37To unset this value again, set it to -1.
38
39When sending emails using SMTP, this command can be used to specify the
40optional SIZE parameter for the MAIL FROM command.
41
42This option does not limit how much data libcurl actually sends, as that is
43controlled entirely by what the read callback returns, but telling one value
44and sending a different amount may lead to errors.
45
46# DEFAULT
47
48Unset
49
50# EXAMPLE
51
52~~~c
53#define FILE_SIZE 123456
54
55int main(void)
56{
57  CURL *curl = curl_easy_init();
58  if(curl) {
59    curl_off_t uploadsize = FILE_SIZE;
60
61    curl_easy_setopt(curl, CURLOPT_URL,
62                     "ftp://example.com/destination.tar.gz");
63
64    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
65
66    curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadsize);
67
68    curl_easy_perform(curl);
69  }
70}
71~~~
72
73# AVAILABILITY
74
75SMTP support added in 7.23.0
76
77# RETURN VALUE
78
79Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
80