cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: File uploading problem

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 6 Oct 2008 14:39:41 +0200 (CEST)

On Mon, 6 Oct 2008, Amit Nargund wrote:

> curl_formadd(&post, &last, CURLFORM_COPYNAME,
> fileelement.m_filename.utf8().data(),
> CURLFORM_FILE, file,

And here's the relevant quote from the fine manual:

CURLFORM_FILE
               followed by a filename, makes this part a file upload part.

"filename" being the keyword. You didn't provide one.

Also, your "working example" showed three different parts while you only add
one in this libcurl code.

> curl_easy_setopt(CurlHandle, CURLOPT_POSTFIELDSIZE, size);

This isn't needed and doesn't even do anything when you use CURLOPT_HTTPPOST.

> curl_easy_cleanup(CurlHandle); //free curl session
> curl_easy_setopt(d->m_handle, CURLOPT_POST, TRUE);

This looks like bad copy and paste.

And for more details on exactly what libcurl sends/receives, use
CURLOPT_DEBUGFUNCTION!

-- 
  / daniel.haxx.se
Received on 2008-10-06

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET