curl-library
Re: multipart uploads not working using easycurl
Date: Wed, 17 Sep 2008 10:20:31 -0500
Perfect! Thank you - that did it. Being able to watch curl interact
with the server is incredibly useful. Using curl's debugging
facilities and the LiveHTTPHeaders addon for FireFox did the trick. I
was able to fix this in short order. The problem ended up being
something simple: I forgot to include on of the form fields in my
post.
In case someone stumbles upon this post in the future, I used debug.c
found in the libcurl distribution (docs/examples/debug.c) to trace the
problem.
Thanks again
On Wed, Sep 17, 2008 at 12:21 AM, Dan Fandrich <dan_at_coneharvesters.com> wrote:
> 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 moved
>
Received on 2008-09-17