I have developed a Win32 Dll in C in order to multipart/formdata httppost
files to an external website on an hourly basis. The dll is invoked from my
database engine once the file has been generated.
The command line equivalent of what I am trying to do is as follows.
C:\curl>curl -Fuserfile=@thefilename https://www.thesite.com/filename
I have managed to get this to work using the following calls.
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curldebug);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data);
res = curl_easy_setopt(curl, CURLOPT_INFILE, hd_src);
curl_formadd(&post, &last, CURLFORM_COPYNAME, "userfile", CURLFORM_FILE,
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
curl_easy_setopt(curl, CURLOPT_URL, filedestination);
curl_easy_setopt(curl, CURLOPT_USERPWD, access);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, (long)file_info.st_size);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 90);
res = curl_easy_perform(curl);
However, the setup fails like clockwork every third time it is executed. It
fails with the exact same curlcode and debug text every time.
The error is curlcode 23 curle_write_error and the debug text is "Failed
I have tried this using my callback function and without using one. The
result is the same. I am unsure of the significance of curle_write_error or
of the debug text above. I am fairly sure that I have just configured my
options incorrectly as I am fairly new to libcurl. Any help would be much
appreciated. I am using curl version 7.10.7.
Any help would be much appreciated.
Securities Services Technology
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-30