curl-library
Re: FTP transfers an empty file??
Date: Thu, 9 Aug 2001 10:26:37 +0200 (MET DST)
(You sure suprised my wife by mailing this to her, but the libcurl mailing
list would've been a much better address! Please use that in the future. This
reply is CC'ed that way.)
> Would you please tell me why this does not work. all this does leave and
> empty file on the sit. Thank you Very much.
[the source code follows here]
int ftpUpLoad()
{
win32_init();
CURL *curl;
CURLcode res;
FILE *ftpfile;
// local file name to store the file as
ftpfile = fopen("D:\\MyAppII\\UtilLib\\ReadMe.txt", "rb"); // b is binary
curl = curl_easy_init();
if(curl)
{
res = curl_easy_setopt(curl, CURLOPT_PROXY, char* proxy );
res = curl_easy_setopt(curl, CURLOPT_URL, char* url );
res = curl_easy_setopt(curl, CURLOPT_USERPWD, char* usrpwd );
res = curl_easy_setopt(curl, CURLOPT_FTPAPPEND, 1);
res = curl_easy_setopt(curl, CURLOPT_INFILE, ftpfile);
res = curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
res = curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
fclose(ftpfile); // close the local file
win32_cleanup();
return 0;
}
This is obviously not a complete source code. How did you specify the URL?
Are you *REALLY* using a proxy? The proxy we're talking about here is a HTTP
proxy (as that's the only kind of proxy libcurl supports), and while libcurl
can pass ftp:// URLs through it, it actually uses HTTP then and thus, the
CURLOPT_FTPAPPEND option is of no use and the CURLOPT_UPLOAD will cause
libcurl to use a HTTP PUT operation.
It might give us some clues if you show us that debug output the
CURLOPT_VERBOSE enables.
I take it you use libcurl 7.8?
-- Daniel Stenberg -- curl dude -- http://curl.haxx.se/ _______________________________________________ Curl-library mailing list http://curl.haxx.se/libcurl/Received on 2001-08-09