curl-library
Problem with ftp upload
Date: Tue, 28 Jul 2009 14:49:32 +0200
Hi!
I'm having a problem with coding a function that uploads a file using ftp. The code is taken over from the example on the homepage. But when curl_easy_perform() is called it returns UPLOAD_FAILED.
This is the log file from the ftp server:
*****************************************
(000108) 2009-07-27 PM 23:23:23 - (not logged in) (121.96.38.5)> USER zensored
(000108) 2009-07-27 PM 23:23:23 - (not logged in) (121.96.38.5)> 331 Password required for zensored
(000108) 2009-07-27 PM 23:23:23 - (not logged in) (121.96.38.5)> PASS **********
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 230 Logged on
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> PWD
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 257 "/" is current directory.
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> CWD vandi
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 250 CWD successful. "/vandi" is current directory.
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> CWD file
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 250 CWD successful. "/vandi/file" is current directory.
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> CWD onlinevoice
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 250 CWD successful. "/vandi/file/onlinevoice" is current directory.
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> EPSV
(000108) 2009-07-27 PM 23:23:23 - zensored (121.96.38.5)> 229 Entering Extended Passive Mode (|||2975|)
(000108) 2009-07-27 PM 23:23:24 - zensored (121.96.38.5)> PASV
(000108) 2009-07-27 PM 23:23:24 - zensored (121.96.38.5)> 227 Entering Passive Mode (211,233,41,118,11,161)
(000108) 2009-07-27 PM 23:23:25 - zensored (121.96.38.5)> disconnected.
And here the code where everything is set up:
**********************************************
curl_easy_setopt(easyhandle,CURLOPT_READFUNCTION,ftp_read_callback);
curl_easy_setopt(easyhandle,CURLOPT_UPLOAD,1L); //Upload
curl_easy_setopt(easyhandle,CURLOPT_URL,_CHR(url)); //URL+Filename
struct curl_slist *headerlist=NULL;
static const char buf_1 [] = "RNFR testfile.txt";
headerlist = curl_slist_append(headerlist, buf_1);
curl_easy_setopt(easyhandle, CURLOPT_POSTQUOTE, headerlist);
curl_easy_setopt(easyhandle,CURLOPT_USERNAME,_CHR(username));
curl_easy_setopt(easyhandle,CURLOPT_PASSWORD,_CHR(password));
curl_easy_setopt(easyhandle,CURLOPT_READDATA,ftp_file.stream);
curl_easy_setopt(easyhandle,CURLOPT_INFILESIZE_LARGE,(curl_off_t)ftp_file.size);
curl_easy_setopt(easyhandle,CURLOPT_NOPROGRESS,0);
curl_easy_setopt(easyhandle,CURLOPT_PROGRESSFUNCTION,ftp_progress_callback);
//after that curl_easy_perform() is started
Another interesting thing is, that the upload works in 1 of 50 tries.
Can somebody help me, please?
Thanks!
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowserReceived on 2009-07-28