TFtpClient.HostFileName
Jump to navigation
Jump to search
Main page -> ICS component reference -> TFtpClient -> HostFileName
Definition
property HostFileName: string;
Default Value
None
Description
Property used when transferring files to and from the server.
Required by Put, PutAsync, Get, and GetAsync.
Example
// Button OnClick Event procedure TFtpAsyncForm.Button1Click(Sender: TObject); begin FtpClient1.HostName := 'ftp.simtel.net'; FtpClient1.Port := 'ftp'; FtpClient1.UserName := 'anonymous'; FtpClient1.Password := 'john.smith@mycomp.com'; FtpClient1.HostDirName := '/pub/simtelnet'; FtpClient1.OpenAsync; // Non-blocking open. end; // FtpClient1 OnRequestDone Event procedure TFtpAsyncForm.FtpClient1RequestDone(Sender: TObject; RqType: TFtpRequest; ErrCode: Word); begin // If error then close connection and exit; if ErrCode <> 0 then begin Display('Error #' + IntToStr(ErrCode)); if (FtpClient1.Connected) then FtpClient1.QuitAsync; Exit; end; try case RqType of ftpOpenAsync: FtpClient1.UserAsync; // Open successful ftpUserAsync: FtpClient1.PassAsync; // User successful ftpPassAsync: FtpClient1.CwdAsync; // Password successful ftpCwdAsync: FtpClient1.TypeSetAsync; // CWD successful ftpTypeSetAsync: // Set type successful begin FtpClient1.HostFileName := 'simtel40.gif'; FtpClient1.LocalFileName := 'C:\simtel40.gif'; FtpClient1.GetAsync; End; ftpGetAsync: QuitAsync; else Application.MessageBox('Unexpected RqType ' + IntToStr(Ord(RqType)), 'FTP', MB_OK); end; except on E:Exception do begin Application.MessageBox('*** ' + E.Message + ' ***', 'FTP', MB_OK); end; end; end;