curl-library
Re: multipart uploads not working using easycurl
Date: Tue, 16 Sep 2008 22:21:59 -0700
On Wed, Sep 17, 2008 at 12:05:22AM -0500, sherman wilcox wrote:
> I'm prototyping an app using libcurl and am having some difficulty.
> I'm trying to perform a simple http upload of binary data using a
> multipart form but it's not working. My upload script is
> http://upload.somesite.com/cgi-bin/script.pl?cmd=uploadform and my
> page to display past uploads is at
> http://upload.somesite.com/cgi-bin/script.pl - The problem is whenever
> I perform the post to
> http://upload.somesite.com/cgi-bin/script.pl?cmd=uploadform I see the
> content from http://upload.somesite.com/cgi-bin/script.pl in my
> console. The post fails, however curl_easy_perform(...) returns
> CURLE_OK. I have attached the .cpp file (based on postit2.c) as well
> as source for the web pages generated by the perl script.
The rule of thumb for this kind of problem is to use the debug callback and
find out exactly what libcurl is sending for the request. Then compare
that to a successful request (using something like LiveHttpHeaders in
Firefox) and modify the program to match. I did see an extra space in
your program after a very brief glimpse.
curl_easy_perform() returns CURLE_OK because it sent the request as
instructed and received a response from the server. You probably want
to use curl_easy_getinfo with CURLINFO_RESPONSE_CODE to get the HTTP
code from the server.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2008-09-17