Indy 9
TIdFTP
Hierarchy, Properties, Methods, Events, See Also, Unit: IdFTP
Implements a File Transfer Protocol (FTP) client.
TIdFTP = class(TIdTCPClient)
Unit
IdFTP
Description
TIdFtp implements a File Transfer Protocol (FTP) client as described in the Internet Standards document:

  • RFC 959 - File Transfer Protocol [FTP] (http://www.rfc-editor.org/rfc/rfc959.txt)

FTP is a basic file-sharing system for uploading and downloading files, as well as managing files and directories. The FTP protocol is commonly used for software distribution, uploading files to a web-server, and providing archives for various purposes.


TIdFTP.CanResume
TIdFTP, See Also
Indicates the FTP site supports FTP Resume operations.
property CanResume: Boolean;
Description
CanResume is a read-only Boolean property that indicates the FTP site supports FTP Resume operations. When the FTP server supports resume, you can use the Get method to resume a previously aborted download. If the FTP server does not support resume, the file has to be retrieved start at the beginning of the file.

CanResume is implemented using the ResumeSupported for read access, and will normally be updated only once per FTP client session by testing the results of the FTP REST command.


TIdFTP.DirectoryListing
TIdFTP, See Also
Container for a structured file and directory listing.
property DirectoryListing: TIdFTPListItems;
Description
DirectoryListing is a read-only TIdFTPList property that represents the container and parser for TIdFTPListItem instances created from the result values for the List or Status methods. DirectoryListing is always cleared prior to adding the values returned by List or Status.

DirectoryListing provides a structured means of accessing data about files and directories returned from the FTP LIST, NLST, or STAT commands. DirectoryListing can also be used to populate GUI controls that display the results of the FTP operation, like TTreeView.

DirectoryListing can be used with the OnParseCustomListFormat event handler to allow parsing of FTP List formats not normally supported by TIdFTPList.

DirectoryListing is initialized prior to use in List, or using the OnCreateFTPList event handler. DirectoryListing is freed in the Destroy method.


TIdFTP.ListResult
TIdFTP, See Also
Container for raw text values returned in an FTP directory listing.
property ListResult: TStrings;
Description
ListResult is a read-only TStrings property used to store the text values returned from an FTP server using the List method. ListResult is also used when attempting to determine the listing format for the items to be created in DirectoryListing. ListResult is intialized in the Create constructor, and freed in the Destroy method.

TIdFTP.LoginMsg
TIdFTP, See Also
Message sent by the FTP server after client log in.
property LoginMsg: TIdRFCReply;
Description
LoginMsg is a TIdRFCReply property that represents the message sent by the FTP server after a successful call to the TIdFTP.Login method. The values in LoginMsg are usually displayed to the user and indicate information such as acceptable use and access policies, a message of the day, or anything else the server wishes mention.

The LoginMsg property is cleared by the ReInitialize method.

Use Greeting to access the welcome message and instructions received as part of the success response code 220 after a calling TIdFTP.Connect.


TIdFTP.OnAfterClientLogin
TIdFTP, See Also
Event handler signalled after a successful Login attempt.
property OnAfterClientLogin: TOnAfterClientLogin;
Description
OnAfterLogin is a TNotifyEvent property that represents the event handler signalled after a successful call to Login, but prior to setting up the connection properties. OnAfterLogin can be used to provide FTP proxy support from the user application.

Applications must assign an procedure to the event handler to allow responding to the event notification.


TIdFTP.Passive
TIdFTP
Determines the FTP data connection method.
property Passive: boolean;
Description
Passive is a Boolean property that determines how a File Transfer Protocol Data connection is made.

If Passive is set to False, the PORT method is used. In this method, TIdFTP uses the TIdSimpleServer to listen for a data connection which is established by the server and the PORT command tells the server where to connect to TIdFTP.

If Passive is set to True, the PASV method is used. In this method, TIdFTP issues the PASV command and the server tells TIdFTP where to establish the data connection. TIdFTP than connects to the server where the server indicated using TIdTCPClient. This method is sometimes used with some proxy configurations. However, some proxy configurations require PORT transfers and some FTP servers do not support PASV transfers.


TIdFTP.Password
TIdFTP, See Also
Indicates the Password used when logging in to the FTP server.
property Password;
Description
Password is a String property that indicates the credentials used when logging in to the FTP server. Username and Password are sent to the FTP server when using the TIdFTP.Login method.

For anonymous file transfers, Password should contain the client email address in the property.

For FTP clients that require connection to a proxy server, the Username and Password properties found in ProxySettings may be used depending on the proxy server type in ProxySettings.


TIdFTP.Port
TIdFTP, See Also
Represents the port number used for the FTP Control channel.
property Port: integer;
Description
Port is an Integer property that represents the port number on the FTP server used to establish the client connection for the FTP Control channel. The default value for Port is IDPORT_FTP, as required by the FTP protocol. Client connections may use the values in ProxySettings when proxied server connections are required.

TIdFTP.ProxySettings
TIdFTP, See Also
property ProxySettings: TIdFtpProxySettings;
Description
ProxySettings is a read-only TIdFtpProxySettings property that represents the optional settings to be used for proxied connections to an FTP server. ProxySettings is allocated in Create, and freed in Destroy.

ProxySettings contains properties that indicate the TIdFtpProxyType to use when establishing the proxied connection using the Host, Port, Username, and Password property values.

The Host and Port values in ProxySettings are used in Connect to establish the control channel connection for the FTP client when ProxySettings.ProxyType contains a value other than fpcmNone.

ProxySettings.ProxyType also indicates both the method and values used for authenticating the proxied connection to the FTP server in Login, according to the following proxy type values and methodologies:

  • fpcmNone - Sends the FTP client Username and optional Password.

  • fpcmUserSite - Sends the ProxySettings Username and optional Password, followed immediately by the FTP client Username and optional Password.

  • fpcmSite - Sends the ProxySettings Username and optional Password, sends the SITE command and the FTP Host property, and the FTP client Username and optional Password.

  • fpcmOpen - Sends the ProxySettings Username and optional Password, sends the OPEN command with the FTP Host property, and the FTP client Username and optional Password.

  • fpcmUserPass - Calls SendCmd with the command USER user@proxyuser@host, calls SendCmd with the command PASS pwd@proxypwd, or optionally PASS pwd.

  • fpcmTransparent - Sends the ProxySettings Username and optional Password, followed immediately by the FTP client Username and optional password.

  • fpcmHttpProxyWithFtp - Not implemented at this time.

TIdFTP.SystemDesc
TIdFTP
Description of the FTP server.
property SystemDesc: string;
Description
SystemDesc is a String property that contians a description of the FTP server. SystemDesc normally contains the name of the operating system for the FTP server, but the value of SystemDesc can be server-specififc.

TIdFTP.TransferType
TIdFTP
Indicates the file transfer type.
property TransferType: TIdFTPTransferType;
Description
TransferType is a TIdFTPTransferType property that indicates the file transfer type currently in use for the FTP client, and can contain one of the following values:

  • ftBinary - Binary (8 bit) file transfers

  • ftASCII - ASCII (7 bit) file transfers

An application should use the ftBinary transfer type for transferring executables, compressed files, graphics, and multimedia files. Use the ftASCII transfer type for 7bit ASCII files, such as text or Hyper Text Markup Language.


TIdFTP.Username
TIdFTP, See Also
Indicates the user name used when logging in to the FTP server.
property Username;
Description
Username is a String property that indicates the user name used when logging in to the FTP server. Username and Password are sent to the FTP server when using the TIdFTP.Login method.

For anonymous file transfers, Username should contain the text anonymous. Use your email address in the Password property when connecting for anonymous file transfers.

For FTP clients that require connection to a proxy server, the Username and Password properties found in ProxySettings may be used depending on the proxy server type in ProxySettings.


TIdFTP.Abort
TIdFTP, See Also
Stops an FTP service operation.
procedure Abort; virtual;
Description
Abort is a procedure that instructs the FTP server to interrupt the current FTP service request, and any associated transfer of data. Abort sends the FTP ABOR command to the server to halt the current operation. Abort forces the socket allocated to the data channel for the FTP session to be disconnected by calling KillDataChannel. Abort does not change the state in Connected for the control channel used in the FTP client.

TIdFTP.Account
TIdFTP, See Also
This method sends additional login information to a FTP Server.
procedure Account(AInfo: String);
Parameters
AInfo: String
The additional login information required by a server.
Description
Account is a procedure used to send additional login information to a FTP Server, in addition to the login information sent by the TIdFTP.Login and TIdFTP.Connect methods. Account can be used when you get the FTP response codes 332 or 532 as a reply to a FTP commands.

Historically, Account is a Telnet string identifying the user's account. The command is not necessarily related to the USER command, as some sites may require an account for login and others only for specific access, such as storing files. If account information is not required for Login, the response code is 230; and if the account information is needed for a command issued later in the dialogue, the server should return a 332 or 532 reply depending on whether it stores (pending receipt of the AccounT command) or discards the command, respectively.


TIdFTP.Allocate
TIdFTP, See Also
Pre-allocates space on a FTP server before you upload a file.
procedure Allocate(AAllocateBytes: Integer);
Parameters
AAllocateBytes: Integer
The number of bytes that should be allocated
Description
This method pre-allocates space on a FTP server before you upload a file using the Put method. It is recommend to use this method before attempting to upload a file. Some servers may require this command while others do not. If a server does not require this command, it should treat this command as if it you had called the TIdFTP.Noop method.

TIdFTP.ChangeDir
TIdFTP, See Also
Changes the current directory on the FTP server file system.
procedure ChangeDir(const ADirName: string);
Parameters
const ADirName: string
path desired on the srver file system.
Description
ChangeDir is a procedure that changes the current directory on the FTP server file system to the subdirectory specified in the ADirName parameter. ChangeDir sends the FTP CWD command to set current directory to the specified value.

Note: RFC 959 indicates that reponse code 250 is the proper success response code for the CWD command. Some server implementations (to remain nameless) return the 250 response code to indicate successful completeion of the CWD command. Indy will recognize both response codes 200 and 250 as the success response code for the CDW command.

Use ChangeDirUp to set the current directory on the FTP server to the directory on level higher in the file system hierarchy.


TIdFTP.ChangeDirUp
TIdFTP, See Also
Changes to the parent directory on the FTP server.
procedure ChangeDirUp;
Description
ChangeDir is a procedure that changes the current directory up one level in the local file system for the FTP server. Use the ChangeDir method to move to a specified directory on the local file system.

Note: RFC 959 indicates that reponse code 200 is the proper success response code for the CWUP command, but mentions that CDUP may also returns the 250 response code permitted for CWD. Indy will recognize both response codes 200 and 250 as the success response code for the CDUP command.


TIdFTP.Connect
TIdFTP, See Also
Opens a connection to the FTP server.
procedure Connect(AAutoLogin: boolean = True; const ATimeout: Integer = IdTimeoutDefault); reintroduce;
Parameters
AAutoLogin: boolean = True
Login the user when connected. Default value is True.
Description
Connect is a procedure that opens the connection to an FTP server using the Host and Port properties. Connect will attempt to use values from the Host and Port properties in ProxySettings when proxied server connections are required, but will revert to the original Host and Port values if an exception occurs. Connect calls the inherited Connect method to open the physical socket handle for the connection.

When the protocol response code from the Server is 220, the values in LastCmdResult are assigned to the Greeting property.

When AutoLogin is True, the Connect method will authenticate the connection using the Login method and trigger the OnAfterLogin event handler. Connect also sends the TransferType for the new connection, and sends the FTP SYST command to get the host FTP server stored in SystemDesc.

After successful completion of the preceeding steps, Connect triggers the OnStatus event handler using the ftpReady status value. If an exception is raised in Connect, Connect calls Disconnect and re-raises the exception for the application exception handler.


TIdFTP.Create
TIdFTP, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method using AOwner as the owner of the object instance.

Create sets the default values used in FTP client properties, including:

Create also sets the value used in the internal flag indicating if support for Resume has been tested to False.

Create also allocates resources required for the LoginMsg, ListResult, and ProxySettings properties.


TIdFTP.Delete
TIdFTP, See Also
Remove a file on the FTP server.
procedure Delete(const AFilename: string);
Description
Delete is a procedure that removes the file specified in AFilename from the file system on the FTP server. Some servers may not give the user permission to delete files on the server file system.

TIdFTP.Destroy
TIdFTP, See Also
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the destructor for the object instance. Destroy frees resources allocated in the Create constructor to the LoginMsg, ListResult, and ProxySettings properties. Destroy also clears and frees the collection in DirectoryListing. Destroy calls the inherited Destroy method prior to exiting.

TIdFTP.FileStructure
TIdFTP, See Also
Sends the data storage format required to the FTP server.
procedure FileStructure(AStructure: TIdFTPDataStructure);
Parameters
AStructure: TIdFTPDataStructure
Data structure for storage of file(s).
Description
FileStructure is a procedure that informs the FTP server of the intended storage format for subsequent FTP commands that transfer data. FileStructure send the FTP STRU command verb and the character representation of the TIdFTPDataStructure value specified in AStructure.

Note: FileStructure has no effect if the FTP client is not Connected.

Use StructureMount to mount a different file system data structure without altering login or account information.

Use TransferType to indicate if the file transfer requires Binary or ASCII representation of data.

Use TransferMode to indicate whether data transfers will use Block, Compressed, or Stream data handling.


TIdFTP.Get
TIdFTP, See Also
Retrieves a file using the FTP protocol.
procedure Get(const ASourceFile: string; ADest: TStream; AResume: Boolean = false); overload;
procedure Get(const ASourceFile: string; const ADestFile: string; const ACanOverwrite: boolean = false; AResume: Boolean = false); overload;
Parameters
const ASourceFile: string
File name on the FTP server.
ADest: TStream
Stream where file data will be written.
AResume: Boolean = false
Partial download can be completed.
const ADestFile: string
File name and optional path on the local machine.
const ACanOverwrite: boolean = false
Overwrite an existing file with the same name.
Description
Get is an overloaded procedure that allows the FTP client to retrieve a file with the name specified in ASourceFile from the FTP server using the FTP RETR command verb. The overloaded implementations of Get use either a file- or a stream-based destination for the data from the FTP server, as specified in ADestFile or ADest.

Get allows continuing a previous partial download or appending data to an existing file on the local file system when AResume is True and CanResume indicates that the FTP server implementation allows the FTP REST command verb.

In the file-based variant of the method, the destination file will be created before retrieving data when ACanOverwrite is True or the file does not already exist. When ACanOverwite is False and AResume is True, the destination file will be opened and position to the end of the file before retrieving data.

An EIdFTPFileAlreadyExists exception will be raised when the destination file in ADestFile already exists, and both ACanOverwrite and AResume contain False.

In the stream-based variant of the Get method, data returned from the FTP server can be accessed in the stream specified in ADest. During data retrieval, Get calls methods that initialize the DataChannel for the FTP client using the connection type specificed in Passive. These protected methods also trigger the OnStatus event handler with the ftpTransfer status value, reads stream data from the FTP server, and signals the the OnStatus event handler with the ftpReady status value on completion. OnStatus maty be triggered with the value ftpAborted if the response code from the FTP server is the numeric value 225.

After completion of the retrieval process, Get signals the OnAfterGet event handler using the stream specified in ADest as an argument.

Use Put to transfer data from the FTP client to the FTP server.


TIdFTP.Get
TIdFTP, See Also
Retrieves a file using the FTP protocol.
procedure Get(const ASourceFile: string; ADest: TStream; AResume: Boolean = false); overload;
procedure Get(const ASourceFile: string; const ADestFile: string; const ACanOverwrite: boolean = false; AResume: Boolean = false); overload;
Parameters
const ASourceFile: string
File name on the FTP server.
ADest: TStream
Stream where file data will be written.
AResume: Boolean = false
Partial download can be completed.
const ADestFile: string
File name and optional path on the local machine.
const ACanOverwrite: boolean = false
Overwrite an existing file with the same name.
Description
Get is an overloaded procedure that allows the FTP client to retrieve a file with the name specified in ASourceFile from the FTP server using the FTP RETR command verb. The overloaded implementations of Get use either a file- or a stream-based destination for the data from the FTP server, as specified in ADestFile or ADest.

Get allows continuing a previous partial download or appending data to an existing file on the local file system when AResume is True and CanResume indicates that the FTP server implementation allows the FTP REST command verb.

In the file-based variant of the method, the destination file will be created before retrieving data when ACanOverwrite is True or the file does not already exist. When ACanOverwite is False and AResume is True, the destination file will be opened and position to the end of the file before retrieving data.

An EIdFTPFileAlreadyExists exception will be raised when the destination file in ADestFile already exists, and both ACanOverwrite and AResume contain False.

In the stream-based variant of the Get method, data returned from the FTP server can be accessed in the stream specified in ADest. During data retrieval, Get calls methods that initialize the DataChannel for the FTP client using the connection type specificed in Passive. These protected methods also trigger the OnStatus event handler with the ftpTransfer status value, reads stream data from the FTP server, and signals the the OnStatus event handler with the ftpReady status value on completion. OnStatus maty be triggered with the value ftpAborted if the response code from the FTP server is the numeric value 225.

After completion of the retrieval process, Get signals the OnAfterGet event handler using the stream specified in ADest as an argument.

Use Put to transfer data from the FTP client to the FTP server.


TIdFTP.Help
TIdFTP, See Also
Requests FTP server capabilities or site-specific implementations.
procedure Help(var AHelpContents: TStringList; ACommand: String = '');
Parameters
var AHelpContents: TStringList
Values returned from the HELP command.
ACommand: String = ''
Optional argument requesting more specific information.
Description
Help is a procedure that retrieves the FTP server capabilities, and other helpful information, using the FTP HELP command. The return values in AHelpContents will reflect information regarding the server implementation status over the control connection to the user.

Help can send the optional argument in ACommand to request more specific information about about value returned in a previous call to Help. The server may use this reply to specify site-dependent parameters, e.g., in response to HELP SITE.

Note: Help has no effect if the FTP client is not Connected. Help can be used prior to Login or other forms of user authentication.


TIdFTP.KillDataChannel
TIdFTP, See Also
Closes the FTP data channel.
procedure KillDataChannel; virtual;
Description
KillDataChannel is a procedure used to force the FTP data channel to be closed. File data is sent or received using the data channel in Put and Get. KillDataChannel closes the socket handle used for the connection.

KillDataChannel is used in the Abort method.


TIdFTP.List
TIdFTP, Example
Gets a list of files and directories on the FTP server.
procedure List(ADest: TStrings; const ASpecifier: string = ''; const ADetails: boolean = true);
Parameters
ADest: TStrings
List for files and directories in the current directory.
const ASpecifier: string = ''
File mask for the listing. Default value is ''.
const ADetails: boolean = true
Include file details. Default value is True.
Description
List is a procedure used to request a list of files or directories in the current directory on the FTP server.

ADest is a TStringList argument used to store the raw text values returned from the FTP server directory listing.

ASpecifier is a String value that contains a mask indicating the files and/or directories to be included in the listing. ASpecifier can contain common wildcard characters like '*' and '?'. Some useful masks include:

  • *.* - All files in the current directory.

  • * - All directory entries in the current directory.

  • *. - All files regardless of extension in the current directory.

  • A??.txt - All text files that have a 3-character name starting with 'A'.

ADetails is a Boolean value that indicates if the list should contain details about the files and directories that match the mask in ASpecifier. When ADetails is False, only the file or directory name is returned in the ADest string list using the FTP NLST command. When ADetails is True, List can return FTP server-dependent details including the file size, date modified, and file permissions for the Owner, Group, and User using the FTP LIST command.

List will initialize and Clear the DirectoryListing property, and parse the return values in ADest into collection items in the DirectoryListing container. When ADest is empty, parsing of the formatted DirectoyListing is omitted.

List stores the return values form the FTP server in the the ListResult property, and allows use for the List command for either stand-alone use or for preparation of the structured DirectoryListing.

List calls methods in DirectoryListing that detects common data formats returned by FTP servers. Applications can override the default detection and parsing behavior by assigning procedures to the OnCheckListFormat and OnParseCustomListFormat event handlers.


TIdFTP.Login
TIdFTP, See Also
Authenticates a client connection to the FTP server.
procedure Login;
Description
Login is a procedure that provides authentication for an FTP client connection to the FTP server using the Username and Password properties. Login provides support for proxied connections to the FTP server through properties and methods in ProxySettings. Set ProxySettings.ProxyType to the TIdFtpProxyType value desired for the connection prior to calling Connect or Login.

Note: Proxied connections using TIdFtpProxyType value fpcmHttpProxyWithFtp are not implemented at this time.

The Password property may not be sent during Login if the FTP server indicates that it does not require it.

Login sets LoginMsg to the values returned in LastCmdResult on successful completion of the login sequence. Login is called by the Connect method, and should be called immediately after using the ReInitialize method.

You may also use the Account method to provide additional information about a client connection on some FTP server implementations.


TIdFTP.MakeDir
TIdFTP, Example
Create a directory on the FTP server.
procedure MakeDir(const ADirName: string);
Parameters
const ADirName: string
Directory to create.
Description
MakeDir is a procedure that requests creation of a directory on the FTP server. Some FTP servers may not allow the user to create new directories.

ADirName is a String that identifies the directory to be created on the FTP server. ADirName must conform to the file naming conventions for the FTP server, or an FTP error response code and message will be returned.


TIdFTP.Noop
TIdFTP, See Also
Send a Keep-Alive signal to the FTP server.
procedure Noop;
Description
Noop is a method that sends a keep-alive signal to the FTP server. Noop is sometimes use to prevent the FTP server from closing a connection which is idle for a long period of time.

TIdFTP.Put
TIdFTP
Uploads a file to an FTP server.
procedure Put(const ASource: TStream; const ADestFile: string = ''; const AAppend: boolean = false); overload;
procedure Put(const ASourceFile: string; const ADestFile: string = ''; const AAppend: boolean = false); overload;
Parameters
const ASource: TStream
Contains data to be uploaded.
const ADestFile: string = ''
Destination file name on the remote FTP server.
const AAppend: boolean = false
Default value is False.
const ASourceFile: string
File containing data to be uploaded.
Description
Put is an overloaded procedure that uploads data to a file with the name specified in ADestFile on the FTP server. The uploaded data can be either a stream (ASource) or a name of a file which exists on the user's computer (ASourceFile).

Setting AAppend to True causes the server to append the file being uploaded to one which already exists on the FTP server.


TIdFTP.Put
TIdFTP
Uploads a file to an FTP server.
procedure Put(const ASource: TStream; const ADestFile: string = ''; const AAppend: boolean = false); overload;
procedure Put(const ASourceFile: string; const ADestFile: string = ''; const AAppend: boolean = false); overload;
Parameters
const ASource: TStream
Contains data to be uploaded.
const ADestFile: string = ''
Destination file name on the remote FTP server.
const AAppend: boolean = false
Default value is False.
const ASourceFile: string
File containing data to be uploaded.
Description
Put is an overloaded procedure that uploads data to a file with the name specified in ADestFile on the FTP server. The uploaded data can be either a stream (ASource) or a name of a file which exists on the user's computer (ASourceFile).

Setting AAppend to True causes the server to append the file being uploaded to one which already exists on the FTP server.


TIdFTP.Quit
TIdFTP, See Also
Closes the FTP client connection.
procedure Quit;
Description
Quit is a procedure used to close a user connection to the FTP server when a file transfer operation is not in progress. Quit closes the control channel for the FTP client. An application should call Abort, when a file transfer is in progress, prior to calling the Quit method.

TIdFTP.Quote
TIdFTP, See Also
Implements execution of FTP commands not supported in this component.
function Quote(const ACommand: String): SmallInt;
Parameters
const ACommand: String
FTP command to be executed.
Return Value
SmallInt - Result code from the FTP operation.
Description
Quote is a SmallInt function that implements execution of the literal FTP command specified in ACommand, and returns the result code from the operation. Quote is used to allow FTP commands that are site-specific or not implemented by the TIdFTP component. For example, Quote is used in TIdFTP to perform the FTP REST command.

Quote executes the string literal in ACommand using the inherited SendCmd method.


TIdFTP.ReInitialize
TIdFTP, See Also
Clears the account and settings for the FTP client.
procedure ReInitialize(ADelay: Cardinal = 10);
Parameters
ADelay: Cardinal = 10
Waiting for Godot.
Description
ReInitialize is a procedure that performs the FTP REIN command for a Connected FTP client. ReInitialize is used to clear the current Account and settings for the FTP client. All TIdFTP properties are reset to the default values, and the control channel is left open. This is identical to the client state immediately after the control channel is opened using Connect.

An application should normally call the Login method after using ReInitialize.


TIdFTP.RemoveDir
TIdFTP, See Also, Example
Remove a directory on the FTP server.
procedure RemoveDir(const ADirName: string);
Parameters
const ADirName: string
Directory to be removed.
Description
RemoveDir is a procedure used to request that the directory in ADirName be removed from the FTP server file hierarchy. Some FTP servers do not allow users to remove directory entries. Use Delete to remove files from the FTP server file system.

TIdFTP.Rename
TIdFTP
Change the name of a file on the FTP server.
procedure Rename(const ASourceFile: string; const ADestFile: string);
Parameters
const ASourceFile: string
Original file name.
const ADestFile: string
New file name.
Description
Rename is a method used to request that the FTP server rename a file from ASourceFile to ADestFile.

TIdFTP.ResumeSupported
TIdFTP, See Also
Indicates if the server implements the FTP REST command.
function ResumeSupported: Boolean;
Return Value
Boolean - True when restart markers are supported.
Description
ResumeSupported is a Boolean function used as the read access specifier for the CanResume property, and indicates if the FTP server implements the FTP REST command. ResumeSupported calls the Quote method using the FTP command literal 'REST 1' to determine if the capability is supported in the FTP server implementation, and calls Quote using the command 'REST 0' to disable the test. When ResumeSupported returns True, the FTP server allows restart markers for file transfer.

ResumeSupported is examined in Get to determine if the FTP REST command is needed to resume file retreival at a specified restart marker.


TIdFTP.RetrieveCurrentDir
TIdFTP, See Also, Example
Gets the current directory name on the FTP server.
function RetrieveCurrentDir: string;
Return Value
String - Current directory name.
Description
RetrieveCurrentDir is a String function that returns the name of the present working directory, or current directory, on the FTP server. The return value for RetrieveCurrentDir will contain the current directory name with leading and trailing quote (") characters removed.

Use ChangeDir or ChangeDirUp to select the current directory by path or relative position in the directory hierarchy.


TIdFTP.Site
TIdFTP
Sends an FTP server site command.
procedure Site(const ACommand: string);
Parameters
const ACommand: string
Server site command to perform.
Description
Site is a procedure used to send a site-specific FTP command directly to the FTP server. Site is used by an FTP server to provide services specific to the host system that are essential to file transfer, but not sufficiently universal to be included as commands in the FTP protocol.

Use the FTP HELP SITE command to discover the commands and syntax requirements for the specific FTP server.


TIdFTP.Size
TIdFTP, Example
Gets file size information from the FTP server.
function Size(const AFileName: String): Integer;
Parameters
const AFileName: String
The file name.
Return Value
Integer - Size of the file or -1 when unknown.
Description
Size is an Integer function used to retrieve file size information for the file specified in AFilename from the FTP server.

TIdFTP.Status
TIdFTP, See Also
Implements the FTP STAT command.
procedure Status(var AStatusList: TStringList);
Parameters
var AStatusList: TStringList
Optional Status response lines from the server.
Description
Status is a procedure that implements the FTP STAT command, and returns a listing containing the status of the FTP operation in progress including transfer parameters and connection status. Status peforms similiar to the List method, but receives response data using the Control channel instead of the Data channel.

Status will populate the DirectoryListing collection after receiving the response stream from the server, or clear DirectoryListing when the nmber of response lines is zero (0).

AStatusList will contain the response from the server if an exception is raised during the method.


TIdFTP.StructureMount
TIdFTP
Mounts a file system data structure for the FTP client.
procedure StructureMount(APath: String);
Parameters
APath: String
Directory or file system structure to be loaded.
Description
StructureMount is a procedure that implement the FTP SMNT command verb, and allows the client to mount a different file system data structure without altering his login or accounting information. APath is the pathname specifying a directory or other system dependent file group designator.

StructureMount calls SendCmd using the SMNT command to perform the requested command.


TIdFTP.TransferMode
TIdFTP, See Also
Implements the FTP MODE command.
procedure TransferMode(ATransferMode: TIdFTPTransferMode);
Parameters
ATransferMode: TIdFTPTransferMode
Transfer mode for the connection.
Description
TransferMode is a procedure that implements the FTP MODE command. TransferMode sends the character representation of the TIdFTPTransferMode value specified in ATransferMode.

TransferMode has no effecet if the client is not Connected.


TIdFTP.OnAfterGet
TIdFTP, See Also
Event handler signalled on completion of the Get method.
property OnAfterGet: TIdFtpAfterGet;
Parameters
ASender
FTP client for the event notification.
VStream
Stream containing data read from the FTP server.
Description
OnAfterGet is a TIdFtpAfterGet property that represents the event handler signalled when the Get method has completed retrieval of file data from the FTP server.

Applications must assign a procedure to the OnAfterGet event handle to allow responding to the event notification. OnAfterGet can be used to perform pre-processing for data found in VStream, or to update progress indicators in the application.


TIdFTP.OnCheckListFormat
TIdFTP, See Also
Event handler signalled when preparing a formatted directory listing.
property OnCheckListFormat: TIdCheckListFormat;
Description
OnCheckListFormat is a TIdCheckListFormat property that represents the event handler signalled when the FTP client is prearing to parse the values for DirectoryListing in the List method. OnCheckListFormat can be used to override the default behavior when detecting the format of data returned in the List or Status methods.

Note: Applications must assign a procedure to the event handler to allow responding to the event notification. In addition, the DirectoryListing.ListFormat property must contain the value flfUnknown for the event handler to be signalled.

The OnCheckListFormat event handler can perform detection of data formats, and assign a new value to the TIdFTPListFormatlist format argument.


TIdFTP.OnCreateFTPList
TIdFTP, See Also
Event handler signalled when a formatted DirectoryListing needs to be created.
property OnCreateFTPList: TIdCreateFTPList;
Description
OnCreateFTPList is a TIdCreateFTPList property that represents the event handler signalled when a formatted DirectoryListing needs to be created prior to loading the results from the List or Status methods. OnCreateFTPList can be used to create and/or populate the TIdFTPList instance used for the DirectoryListing property.

Applications must assign a procedure to the event handler to allow responding to the event notification. TIdFTP creates a TIdFTPList class instance using the default values when OnCreateFTPList has not been assigned.


TIdFTP.OnParseCustomListFormat
TIdFTP, See Also
Event handler to use for custom parsing of a formatted Directory listing.
property OnParseCustomListFormat: TIdOnParseCustomListFormat;
Description
OnParseCustomListFormat is a TIdOnParseCustomListFormat property that represents the event handler used to parse data values returned by the List or Status methods. OnParseCustomListFormat allows customized parsing of values in TIdFTPListItem.Data, when the data format is not supported by TIdFTPList.

Applications can assign a procedure to the OnParseCustomListFormat event handler to enable parsing collection items in the DirectoryListing property when the FTP list format contains the value flfCustom. The event handler should examine values in TIdFTPListItem.Data to parse values for other TIdFTPListItem properties.

OnParseCustomListFormat is assigned to the OnParseCustomListFormat event handler for the DirectoryListing property prior to loading the content of the formatted directory listing.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.