curl-library
help, PUT/File upload
Date: Fri, 2 Feb 2001 01:44:23 GMT
Hi this is my code to upload a file, c:\test.zip to my webserver.
win32_init() and win32_cleanup() are copied from the second sample.
The problem is 'res' gets error 23, every time.
Am i missing some option setting?
Please help.
I'm using BCB5 std.
void __fastcall TForm1::dowork(){
CURL *curl;
CURLcode res;
FILE *infile;
win32_init();
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://www.niche.f2s.com/cgi-
bin/upload.pl");
curl_easy_setopt(curl, CURLOPT_USERPWD, "niche:niche");
curl_easy_setopt(curl, CURLOPT_PUT, 1);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data);
infile = fopen("c:\\test.zip", "rb");
struct stat fileinfo;
stat("c:\\test.zip", &fileinfo);
int infilesize = fileinfo.st_size;
curl_easy_setopt(curl, CURLOPT_INFILE, infile);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, infilesize);
res = curl_easy_perform(curl);
if (res == 0) {
ShowMessage("GOOD");
} else {
ShowMessage(res);
}
curl_easy_cleanup(curl);
}
win32_cleanup();
fclose(infile);
return;
}
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-02-02