1--- 2c: Copyright (C) Daniel Stenberg, <daniel.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) 11--- 12 13# NAME 14 15CURLINFO_CONTENT_LENGTH_UPLOAD - 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, 23 double *content_length); 24~~~ 25 26# DESCRIPTION 27 28Pass a pointer to a double to receive the specified size of the upload. Since 297.19.4, this returns -1 if the size is not known. 30 31CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) is a newer replacement that returns a 32more sensible variable type. 33 34# PROTOCOLS 35 36All 37 38# EXAMPLE 39 40~~~c 41int main(void) 42{ 43 CURL *curl = curl_easy_init(); 44 if(curl) { 45 CURLcode res; 46 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 47 48 /* Perform the upload */ 49 res = curl_easy_perform(curl); 50 51 if(!res) { 52 /* check the size */ 53 double cl; 54 res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl); 55 if(!res) { 56 printf("Size: %.0f\n", cl); 57 } 58 } 59 } 60} 61~~~ 62 63# AVAILABILITY 64 65Added in 7.6.1. Deprecated since 7.55.0. 66 67# RETURN VALUE 68 69Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 70