GNURLINFO...GTH_UPLOAD(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… NAME πŸ’…

CURLINFO_CONTENT_LENGTH_UPLOAD β€” get the specified size of the upload. This page is from the curl_easy_getinfo options manual, aka the GNURLINFO...GTH_UPLOAD(3) page if you're looking at the header β€” and yes bestie, we're getting that upload size. πŸŽ€

✨ SYNOPSIS ✨

       #include <gnurl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a pointer to a double β€” literally a double * β€” and it receives the specified size of the upload. Since 7.19.4, this returns -1 if the size isn't known. No cap.

Also: CURLINFO_CONTENT_LENGTH_UPLOAD_T(3) is a newer replacement that returns a more sensible variable type. So if you want the upgraded version, that's the one. πŸ’–

🌈 PROTOCOLS 🌈

All. Every single protocol, slay. ✨

🌸 EXAMPLE 🌸

       CURL *curl = curl_easy_init();
       if(curl) {
         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

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

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

πŸŽ€ AVAILABILITY πŸŽ€

Added in 7.6.1. Oldie but goodie. 🫢

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. That's the whole vibe check. πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘


This manual page moment was brought to you by libcurl 7.44.0, dated 1 Sep 2015, from the GNURLINFO...GTH_UPLOAD(3) page β€” mwah, love u, bye πŸ’‹

πŸ“¦ where this page comes from