curl-users
uploading files to a remote system
Date: Tue, 28 Aug 2001 12:30:35 -0000
Hello,
When I run this, I get the result of the dir FTP command; the listing of the
files on the remote system ; on the standard output an I can not find my
file 'rocket' on the remote system.
res is equal CURL_OK after the perform call
Thanks.
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
FILE *ftpfile;
FILE * hd_src ;
int hd ;
struct stat file_info;
struct curl_slist *headerlist=NULL;
char buf[] = "rename toto toto_renamed";
hd = open("/tmp/rocket",O_RDONLY) ;
fstat(hd, &file_info);
close(hd) ;
/* local file name to store the file as */
hd_src = fopen("/tmp/rocket", "rb"); /* b is binary for win */
curl = curl_easy_init();
if(curl) {
//headerlist = curl_slist_append(headerlist, buf);
//curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
curl_easy_setopt(curl, CURLOPT_URL,
"ftp://root:rootpasswd@192.168.200.211");
curl_easy_setopt(curl, CURLOPT_INFILE, hd_src);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_info.st_size);
res = curl_easy_perform(curl);
//curl_slist_free_all (headerlist);
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(hd_src); /* close the local file */
return 0;
}
Received on 2001-08-28