ibec_ftp_GetFile
Description
ibec_ftp_GetFile copies a file from the FTP server to the local computer.
Syntax
function ibec_ftp_GetFile(FTPSession : variant; FTPFileName : string; LocalFileName : string) : boolean;
ibec_ftp_GetFile copies a file specified by the FTPFileName variable from the FTP server to the local computer. LocalFileName specifies the name to use on the local computer. If LocalFileName is specified as NULL or an empty string the content of the remote file will be saved into internal buffers of the FTP session object and can be retrieved later by using the ibec_ftp_GetProperty function.
ibec_ftp_GetFile returns TRUE in case of success. Otherwise it returns FALSE.
Example 1
FTPSession = ibec_ftp_OpenSession('HostName=myftpserver.com; UserName=me;
Password=mysecret');
try
if (ibec_ftp_Connect(FTPSession)) then
begin
if (ibec_ftp_ChangeDir(FTPSession, '\uploads')) then
begin
ibec_ftp_GetFile(FTPSession, 'db.fdb', 'd:\mydata\db.fdb');
end;
ibec_ftp_Disconnect(FTPSession);
end;
finally
ibec_ftp_CloseSession(FTPSession);
end;
Example 2
FTPSession = ibec_ftp_OpenSession('HostName=myftpserver.com; UserName=me;
Password=mysecret');
try
if (ibec_ftp_Connect(FTPSession)) then
begin
if (ibec_ftp_ChangeDir(FTPSession, '\uploads')) then
begin
if (ibec_ftp_GetFile(FTPSession, 'db.fdb', NULL)) then
begin
FileData = ibec_ftp_GetProperty(FTPSession, 'DATA');
ibec_SaveToFile(FileData, 'd:\mydata\db.fdb', __stfOverWrite);
ibec_ftp_SetProperty(FTPSession, 'DATA', ''); -- Just to clear the data buffer
end;
end;
ibec_ftp_Disconnect(FTPSession);
end;
finally
ibec_ftp_CloseSession(FTPSession);
end;
See also:
ibec_ftp_PutFile
ibec_ftp examples
back to top of page
<< ibec_ftp_FileDateTime | IBEBlock | ibec_ftp_PutFile >>







