cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Uploading a file via HTTP Post

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 1 Jul 2007 16:32:43 +0200 (CEST)

On Sun, 1 Jul 2007, Allen Pulsifer wrote:

> Have you tried simply setting those two headers, using something like:
>
> struct curl_slist *headers;
>
> headers = curl_slist_append(headers, "Content-Disposition: form-data;
> name=\"upload_file\"; filename=\"filename.torrent\"");
> headers = curl_slist_append(headers, "Content-Type:
> application/octet-stream");
> curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers);

That won't work at all, since this will add the headers to the request while
Carter wants to modify the header(s) for the specific formpart with the
"attached" file.

CURLFORM_FILENAME is what should be used, as Robert already hinted.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-07-01