quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_INFILESIZE.md (1973B)


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