CURLINFO_CONTENT_LENGTH_UPLOAD.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLINFO_CONTENT_LENGTH_UPLOAD.md
  2. .TH CURLINFO_CONTENT_LENGTH_UPLOAD 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_CONTENT_LENGTH_UPLOAD \- get the specified size of the upload
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_UPLOAD,
  9. double *content_length);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a double to receive the specified size of the upload. Since
  13. 7.19.4, this returns \-1 if the size is not known.
  14. \fICURLINFO_CONTENT_LENGTH_UPLOAD_T(3)\fP is a newer replacement that returns a
  15. more sensible variable type.
  16. .SH PROTOCOLS
  17. This functionality affects all supported protocols
  18. .SH EXAMPLE
  19. .nf
  20. int main(void)
  21. {
  22. CURL *curl = curl_easy_init();
  23. if(curl) {
  24. CURLcode res;
  25. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  26. /* Perform the upload */
  27. res = curl_easy_perform(curl);
  28. if(!res) {
  29. /* check the size */
  30. double cl;
  31. res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &cl);
  32. if(!res) {
  33. printf("Size: %.0f\\n", cl);
  34. }
  35. }
  36. }
  37. }
  38. .fi
  39. .SH DEPRECATED
  40. Deprecated since 7.55.0.
  41. .SH AVAILABILITY
  42. Added in curl 7.6.1
  43. .SH RETURN VALUE
  44. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  45. .SH SEE ALSO
  46. .BR CURLINFO_CONTENT_LENGTH_DOWNLOAD_T (3),
  47. .BR curl_easy_getinfo (3),
  48. .BR curl_easy_setopt (3)