cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How do I use multipart form posts?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Mar 2010 23:17:22 +0100 (CET)

On Fri, 26 Mar 2010, Jonathan Wallace wrote:

> struct curl_httppost * post = NULL;
> struct curl_httppost * last = NULL;
> curl_formadd(&post, &last,
> CURLFORM_COPYNAME, "aSetValue",
> CURLFORM_FILENAME, file.c_str(),
> CURLFORM_END);
> curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
>
> But that sends only the headers that I define elsewhere with a
> Content-Length of 0.

Don't define such headers, that's counter-productive.

Did you read the curl_formadd man page and check out its example?
http://curl.haxx.se/libcurl/c/curl_formadd.html

There's a big difference between CURLFORM_FILENAME and CURLFORM_FILE...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-26