cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Problems with CURLFORM_FILE?

From: Urban Johansson <urban.johansson_at_aptic.se>
Date: Fri, 20 Oct 2006 16:01:32 +0200

OK, so I modified the code a litte bit:

        Int c_formadd = 0;
      c_formadd = curl_formadd(&opost, &olast,
        CURLFORM_COPYNAME, "sendfile",
        CURLFORM_FILE, "c:\\test.jpg",
        CURLFORM_END);

      c_formadd = curl_formadd(&opost,
         &olast,
         CURLFORM_COPYNAME, "filename",
         CURLFORM_COPYCONTENTS, "test.jpg",
         CURLFORM_END);
I added an extra \ to the CURLFORM_FILE and also set a name and added an
extra curl_formadd() for a field that contains the filename. When I
execute the code both curl_formadd() returns 0, but it still looks like
the server
never receives the file.

Any ideas?

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: den 20 oktober 2006 12:51
To: libcurl development
Subject: Re: Problems with CURLFORM_FILE?

On Fri, 20 Oct 2006, Urban Johansson wrote:

> curl_formadd(&opost, &olast, CURLFORM_FILE,
> "c:\test.jpg",CURLFORM_END);

This only sets the content of this part, not the name. I think you have
to set the name for the part for it to work. Did you check the return
code from curl_formadd()?

Compare with this (working) example:

   http://curl.haxx.se/lxr/source/docs/examples/multi-post.c

--
  Commercial curl and libcurl Technical Support:
http://haxx.se/curl.html
Received on 2006-10-20