ibec_ftp_SetProperty

Description

ibec_ftp_SetProperty sets the value of the specified property.

Syntax

 function ibec_ftp_SetProperty(FTPSession : variant; PropertyName : string; Value : variant) : variant;

ibec_ftp_SetProperty sets the value of the specified property of the FTP server object. PropertyName is the name of the property to read. ibec_ftp_PutFile returns TRUE in case of success. Otherwise it returns FALSE.

The following properties are available for writing:

Host (or HostName)sets the URL of the FTP server, meaningless after the connection has already been established.
User (or UserName)sets the user name, meaningless after the connection has already been established.
Pass (or Password)sets the password, meaningless after the connection has already been established.
Portsets the port number, meaningless after the connection has already been established.
Datasets the value of the internal data buffer.
SessionLogsets the value of the internal session log variable. May be used to clear the log if necessary.

Example

 FTPSession = ibec_ftp_OpenSession('');
    try 
      ibec_ftp_SetProperty(FTPSession, 'host', 'myftpserver.com');
      ibec_ftp_SetProperty(FTPSession, 'user', 'me');
      ibec_ftp_SetProperty(FTPSession, 'pass', 'mysecret');
      ibec_ftp_SetProperty(FTPSession, 'port', 25);
      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);
        SessionLog = ibec_ftp_GetProperty(FTPSession, 'SessionLog');
        ibec_SaveToFile('D:\Temp\ftplog.txt', SessionLog, __stfOverwrite);
      end;
    finally
      ibec_ftp_CloseSession(FTPSession); 
    end; 

See also:
ibec_ftp_GetProperty
ibec_ftp examples

back to top of page
<< ibec_ftp_GetProperty | IBEBlock | ibec_pop3_OpenSession >>