CURLINFO_C...GTH_UPLOAD(3)

πŸ’… CURLINFO_CONTENT_LENGTH_UPLOAD πŸ’…

okay bestie, so this one's from the libcurl corner of the Library Functions Manual β€” yes THE libcurl, the one that's been carrying the whole internet on its back since forever. buckle up πŸŽ€


✨ NAME ✨

CURLINFO_CONTENT_LENGTH_UPLOAD β€” literally just the specified size of the upload. that's it. that's the whole vibe. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD,
                           double *content_length);

🌸 DESCRIPTION 🌸

so you pass in a pointer to a double, and it gets filled with the specified size of the upload. simple as that, no cap. 🫢

since 7.19.4, if the size isn't known, this thing just returns -1. iconic behavior honestly.

also quick heads up: CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) is the newer replacement and it returns a way more sensible variable type. so like… do with that information what you will πŸ’…


🌈 PROTOCOLS 🌈

this functionality affects all supported protocols. all of them. every single one. ate and left no crumbs πŸ‘‘


🧚 EXAMPLE 🧚

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");

    /* Perform the upload */
    result = curl_easy_perform(curl);

    if(!result) {
      /* check the size */
      double cl;
      result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
      if(!result) {
        printf("Size: %.0f\n", cl);
      }
    }
  }
}

look at that little main character doing its thing 😭✨


πŸ’€ DEPRECATED πŸ’€

deprecated since 7.55.0. she's a legacy icon but she's still deprecated, bestie β€” know the difference πŸ™ˆ

πŸ“ AVAILABILITY πŸ“

added in curl 7.6.1. vintage. retro. lowkey a historical artifact at this point πŸŽ€


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK β€” slay. non-zero means an error occurred, no cap, go check libcurl-errors(3) for the tea πŸ”₯


πŸŽ€ SEE ALSO πŸŽ€


and that's the whole page, bestie 🫢 brought to you by libcurl, dated 2026-10-12, living that CURLINFO_C...GTH_UPLOAD(3) life to the very last line πŸ’–βœ¨ go forth and upload responsibly 🌸

πŸ“¦ where this page comes from