<< ibec_ftp_GetFile | IBEBlock | ibec_ftp_LastResponse >>

ibec_ftp_PutFile

Description

ibec_ftp_PutFile copies a local file to the FTP server.

Syntax

 function ibec_ftp_PutFile(FTPSession : variant; LocalFileName : string; FTPFileName : string) : boolean;

ibec_ftp_PutFile copies a file specified by the LocalFileName variable from the local computer to the FTP server. If LocalFileName is specified as NULL or an empty string the content of the internal data buffer will be copied to the FTP server. FTPFileName specifies the name to use on the FTP server. ibec_ftp_PutFile 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_PutFile(FTPSession, 'd:\mydata\db.fdb', '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
          FileData = ibec_LoadFromFile('d:\mydata\db.fdb');
          ibec_ftp_SetProperty(FTPSession, 'DATA', FileData);  
          ibec_ftp_PutFile(FTPSession, NULL, 'db.fdb');
          ibec_ftp_SetProperty(FTPSession, 'DATA', ''); -- Just to clear the data buffer
        end;
        ibec_ftp_Disconnect(FTPSession);
      end;
    finally
      ibec_ftp_CloseSession(FTPSession); 
    end;

See also:
ibec_ftp_GetFile

back to top of page
<< ibec_ftp_GetFile | IBEBlock | ibec_ftp_LastResponse >>