curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: curl_mime questions

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 29 Oct 2019 09:46:04 +0100 (CET)

On Tue, 29 Oct 2019, ka sc wrote:

Hi ka,

First a few things on mailing list use:

1. Don't reply as a short-cut to start new threads. If your question is about
something new, then create a new mail and write a new subject. People get
mails threaded and expect replies to concern the original topic.

2. Don't top-post. Writing your comment on something and showing the entire
previous mail quoted below works for private email but is terribly for email
conversations. In this case when the entire quoted part is totally meaningless
for your new mail it is even worse. You should remove irrelevant quotes.

3. There are literally *thousands* of people receiving each mail on this
mailing list. It makes sense for authors to spend two extra minutes to make
sure a thousand people can save 20 seconds each when receiving it, while at
the same time seriously increase the chances of someone actually reading and
responding to the email you send.

> So another newbie question just to confirm: after reading the docs more one
> doesnt actually send files, even in the case below its actually always
> buffer?

> curl_mime *mime;
> curl_mimepart *part;
> // create a mime handle
> mime = curl_mime_init(easy);
> // add a part
> part = curl_mime_addpart(mime);
> // send data from this file
> curl_mime_filedata(part, "image.png");
> // set name
> curl_mime_name(part, "data");

I'm not sure I understand the question.

A multi-part formpost is a series of parts included in the body of a POST.
Each such part has a name and contents (and a set of headers). There can be
any number of parts.

A specific part that is a "file upload" typically also has a file name.

You can set all those things with the curl_mime_ API.

I personally think the postit2 example shows this pretty clearly:

   https://curl.haxx.se/libcurl/c/postit2.html

-- 
  / daniel.haxx.se | Get the best commercial curl support there is - from me
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-10-29