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