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