gnurl_mime_filename(3)

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

πŸ’… NAME πŸ’…

okay so bestie, this page is gnurl_mime_filename(3) from the libgnurl manual, and the actual function is curl_mime_filename β€” and its whole job is setting a mime part's remote file name. periodt. πŸ’–

✨ SYNOPSIS ✨

like, here's the exact signature, no cap:

#include <gnurl/curl.h>

CURLcode curl_mime_filename(curl_mimepart * part, const char *
       filename);

πŸ¦‹ DESCRIPTION πŸ¦‹

curl_mime_filename(3) sets a mime part's remote file name. Once that remote file name is set, the content data is processed as a file, whatever is the part's content source β€” yes, even then, bestie. πŸ”₯

That remote file name gets transmitted to the server in the associated Content-Disposition generated header. it's giving file-upload realness.

part is the part's handle to assign the remote file name to. πŸŽ€

filename points to the null-terminated file name string; it may be set to NULL to remove a previously attached remote file name. (NULL = unset, cute and legal.) 🌸

The remote file name string is copied into the part, thus the associated storage may safely be released or reused after call. so like, the part has its own copy and you can release or reuse that storage after the call. 🫢

Setting a part's file name twice is valid: only the value set by the last call is retained. last call wins, periodt. πŸ‘‘

🌈 AVAILABILITY 🌈

As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0. ✨

πŸŽ€ RETURN VALUE πŸŽ€

CURLE_OK or a CURL error code upon failure. that's the whole story, bestie. πŸ’…

πŸ”₯ EXAMPLE πŸ”₯

        curl_mime *mime;
        curl_mimepart *part;

        /* create a mime handle */
        mime = curl_mime_init(easy);

        /* add a part */
        part = curl_mime_addpart(mime);

        /* send image data from memory */
        curl_mime_data(part, imagebuf, imagebuf_len);

        /* set a file name to make it look like a file upload */
        curl_mime_filename(part, "image.png");

        /* set name */
        curl_mime_name(part, "data");

πŸ‘‘ SEE ALSO πŸ‘‘


xoxo bestie, source/version: libcurl 7.56.0, dated 22 August 2017 β€” go make your mime parts look like file uploads, no cap. πŸ’…βœ¨

πŸ“¦ where this page comes from