Hi Guys!
Thx fol all! The code is ready:).
It's error free:)
Ftp login : OK
It can read file name and file size from ftp server.
BUT, download file does not start.
...I skip any command or don't use any function?
The code samle :
ftp := TFTPSend.Create;
try
ftp.DSock.OnStatus := @SockGetCallBack; // Update progressbar
ftp.Username := EditUser.text;
ftp.Password := EditPassw.text;
ftp.TargetHost := EditFtpServer.text;
ftp.TargetPort := EditPort.text;
//
if ftp.Login then
MemoLog.Lines.Add('Login: success')
else
begin
MemoLog.Lines.Add('Login: incorrect');
exit;
end;
ftp.DirectFileName := EditLocalFile.Text;
ftp.DirectFile := true;
TotalBytes := ftp.FileSize(EditRemoteFile.Text);
MemoLog.Lines.Add('Load file: ' + EditRemoteFile.Text);
MemoLog.Lines.Add('TotalBytes: ' + IntToStr(TotalBytes));
if ftp.RetrieveFile(EditRemoteFile.Text, false) = true then
MemoLog.Lines.Add('Transfer completed')
else
MemoLog.lines.add('Transfer failed');
ftp.Logout;
MemoLog.Lines.Add('Connection closed');