• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_CONTENT_LENGTH_UPLOAD_T
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3)
9  - curl_easy_getinfo (3)
10  - curl_easy_setopt (3)
11---
12
13# NAME
14
15CURLINFO_CONTENT_LENGTH_UPLOAD_T - get the specified size of the upload
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD_T,
23                           curl_off_t *content_length);
24~~~
25
26# DESCRIPTION
27
28Pass a pointer to a *curl_off_t* to receive the specified size of the
29upload. Stores -1 if the size is not known.
30
31# PROTOCOLS
32
33All
34
35# EXAMPLE
36
37~~~c
38int main(void)
39{
40  CURL *curl = curl_easy_init();
41  if(curl) {
42    CURLcode res;
43    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
44
45    /* Perform the upload */
46    res = curl_easy_perform(curl);
47
48    if(!res) {
49      /* check the size */
50      curl_off_t cl;
51      res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD_T, &cl);
52      if(!res) {
53        printf("Upload size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
54      }
55    }
56  }
57}
58~~~
59
60# AVAILABILITY
61
62Added in 7.55.0
63
64# RETURN VALUE
65
66Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
67