cURL / Mailing Lists / curl-library / Single Mail

curl-library

multipart uploads not working using easycurl

From: sherman wilcox <wilcox.sherman_at_gmail.com>
Date: Wed, 17 Sep 2008 00:05:22 -0500

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.

If I comment out this line:
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);

I see the content from the correct page but of course the post fails.

attached files:
main.cpp - my modified version of postit2.c
script.pl.html - contents of the perl script when ran with no arguments
script.pl.upload.html - contents of the perl script when ran with the
argument ?cmd=uploadform

I'm guessing this is a trivial matter to address. I'm just not sure
where to begin.

Received on 2008-09-17