DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


TFtpConnection

FTP is a protocol allows to upload and download files to/from a remote server. The class TFtpConnection provides an encapsulation of the FTP protocol interpreter that acts as the control channel or communication path for the exchange of FTP commands and their specific FTP replies. Several key properties and methods are used to establish the control channel for the FTP session:

Properties Methods  

Example: The following example creates an FTP session, opens it, creates a subdirectory 'testftp' and stores the selected file in this directory.
program TestFtpClass;

const
  USERID = 'myusername';
  SERVER = 'ftp.myserver.com';

var
  MyFtp : TFtpConnection;
  FName : string;
  pwd   : string;

begin
FName := SelectFile ('c:\temp', '', '');
if FName <> '' then
  begin
  pwd := TextDialog ('', 'Please enter your password', true);
  if pwd <> '' then
    begin
    MyFtp := TFtpConnection.Create(nil);
    MyFtp.Host := SERVER;
    MyFtp.UserId := USERID;
    MyFtp.Pwd := pwd;
    MyFtp.TimeOut := 3500;
    if MyFtp.Connect = 0 then
      begin
      MyFtp.MakeDir ('testftp');
      MyFtp.Upload (FName, 'testftp/'+ExtractFilename(FName), false);
      end;
    MyFtp.Free;
    end;
  end;
end.
Please note that you have to adjust the constants USERID and SERVER to reflect the access credentials of your FTP server.