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