Estoy desarrollando un programa para subir archivos a un ftp y esperar por la respuesta (en otro archivo), descargarlo y borrarlo.
Ya tengo 2/3 partes es decir, subir y bajar archivos, ¿Alguien sabe (seaone



Saludos
Escrito 21 octubre 2011 - 04:29
Escrito 21 octubre 2011 - 05:20
// Esto sirve para ignorar la respuesta del servidor function Ignorar(Buffer: PAnsiChar; Size, Count: Integer; Stream: TStream): Integer; cdecl; begin Result:= Count; end; function Borrar(Usuario, Clave, Servidor, Archivo: AnsiString): Boolean; var Curl: TCURL; Comandos: pcurl_slist; begin Result:= FALSE; Curl:= curl_easy_init; if Curl <> nil then try if curl_easy_setopt(Curl, CURLOPT_VERBOSE, TRUE) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_USE_SSL, CURLUSESSL_ALL) <> CURLE_OK then Exit; // No verificamos la identidad del servidor, suponemos que es quien dice ser if curl_easy_setopt(Curl, CURLOPT_SSL_VERIFYPEER, FALSE) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_USERNAME, PAnsiChar(Usuario)) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_PASSWORD, PAnsiChar(Clave)) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_URL, PChar(Servidor)) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, @Ignorar) <> CURLE_OK then Exit; if curl_easy_setopt(Curl, CURLOPT_FILE, nil) <> CURLE_OK then Exit; Comandos:= nil; Comandos:= curl_slist_append(Comandos,PAnsiChar('rm ' + Archivo)); try if curl_easy_setopt(Curl, CURLOPT_QUOTE, Comandos) <> CURLE_OK then Exit; Result:= curl_easy_perform(Curl) = CURLE_OK; finally curl_slist_free_all(Comandos); end; finally curl_easy_cleanup(Curl); end; end; Borrar('usuario','password','sftp://127.0.0.1/','/test/test/test.txt');
Escrito 21 octubre 2011 - 05:22