cURL / Mailing Lists / curl-library / Single Mail

curl-library

Obtaining response after upload file

From: Danny Su <thedumbkid_at_gmail.com>
Date: Mon, 26 Dec 2005 02:24:48 -0500

Hi everyone,
I'm wondering if somebody can give me some help on getting libcurl to work.
I want to be able to post to a form and use the form to upload a file.
Afterwards I want to parse the resulting page that is produced.
When I use a browser (IE or Firefox), after I submit the form I will
receive a resulting webpage telling me some information.
However, when I use libcurl, I get nothing.
My WRITEFUNCTION doesn't even get invoked!

Does somebody know why?
Thanks!
/Danny

code:

curl_formadd(&formpost,
             &lastptr,
             CURLFORM_COPYNAME, "file",
             CURLFORM_FILE, ofn.lpstrFile,
             CURLFORM_END);

CURL *curl = curl_easy_init();
CURLcode res;

// upload the file
curl_easy_setopt(curl, CURLOPT_URL, "http://mydomain/");
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &hwnd);
res = curl_easy_perform(curl);
Received on 2005-12-26