GNURLOPT_INFILESIZE(3)

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

GNURLOPT_INFILESIZE(3) πŸ’…

okay bestie, welcome to the GNURLOPT_INFILESIZE(3) page from the curl_easy_setopt options manual β€” gnurl edition, group-chat style. this is all about telling libcurl how big ur upload is gonna be 🫢✨

πŸ’– NAME πŸ’–

CURLOPT_INFILESIZE β€” set size of the input file to send off πŸ’…

πŸ“œ SYNOPSIS πŸ“œ

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INFILESIZE, long
filesize);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so when ur uploading a file to a remote site, filesize should be used to tell libcurl what the expected size of the input file is. it must be passed as a long, no cap. if ur file is bigger than 2GB, see CURLOPT_INFILESIZE_LARGE(3) β€” she's the one for the big girlie files πŸ’–

for uploading using SCP, this option or CURLOPT_INFILESIZE_LARGE(3) is mandatory β€” like, u literally need one of them, bestie.

wanna unset this value again? set it to -1. periodt.

when sending emails using SMTP, this command can be used to specify the optional SIZE parameter for the MAIL FROM command πŸ“§βœ¨

vibe check / important caveat: this option does not limit how much data libcurl will actually send, because that is controlled entirely by what the read callback returns. but telling one value and sending a different amount may lead to errors 😭

πŸŽ€ DEFAULT πŸŽ€

Unset β€” she's just unset πŸ’€

🌈 PROTOCOLS 🌈

Many ✨

πŸ’» EXAMPLE πŸ’»

CURL *curl = curl_easy_init();
if(curl) {
  long uploadsize = FILE_SIZE;

  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/destination.tar.gz");

  curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

  curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);

  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

SMTP support added in 7.23.0 πŸŽ‰

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's the tea β˜•

πŸ‘‘ SEE ALSO πŸ‘‘

πŸŽ€ xoxo, this page is from libcurl 7.37.0, dated 17 Jun 2014, and it's the GNURLOPT_INFILESIZE(3) manual signing off β€” mwah πŸ’–
πŸ“¦ where this page comes from