cURL / Mailing Lists / curl-library / Single Mail

curl-library

File Upload POST using libcurl

From: koderr <koderr_at_bk.ru>
Date: Sat, 8 Nov 2008 17:59:21 +0500

How I can do this:

curl -F upload=@localfilename -F press=OK [URL]

using libcurl?

Tried the following options:

curl_easy_setopt(curl_handle, CURLOPT_URL, szUrl);
curl_easy_setopt(curl_handle, CURLOPT_REFERER, szUrl);
curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, szPostData);
curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_POST, TRUE);
curl_easy_setopt(curl_handle, CURLOPT_READDATA, fd);
curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback);
curl_easy_setopt(curl_handle, CURLOPT_COOKIE, szCookie);
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, szAgent);

It does PUT with "Expect: 100-continue".

-- 
Best regards,
 koderr                          mailto:koderr_at_bk.ru
Received on 2008-11-08