GNURLINFO...GTH_UPLOAD(3)
π 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
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms