Topic Path: Symbol Reference > Classes > TIdFTP Class > TIdFTP Methods > Put Method > Put Method (string, string, boolean)
ContentsIndexHome
PreviousUpNext
TIdFTP.Put Method (string, string, boolean)

Uploads a file to an FTP server.

procedure Put(
    const ASourceFile: string; 
    const ADestFile: string = ''; 
    const AAppend: boolean = false
); overload;
Parameters 
Description 
ASourceFile 
File containing data to be uploaded.
 
ADestFile 
Destination file name on the remote FTP server. Default value is ''.
 
AAppend 
Indicates content should be appended to existing data. Default value is false. 

Put is an overloaded procedure used to upload the contents of a file or streak found on the local client to a specified file on the remote FTP server. 

ASource is a stream descendant with the local content to be transferred to the remote FTP server. 

ASourceFile specified a file name (with optional relative or absolute path information) for the local content to be transferred to the remote FTP server. 

ADestFile is the file name used to stored the content on the remote FTP server. ADestFile can contain path information (in either relative or absolute form) as well as a valid file name for the remote file system. When path information is omitted, the file in ADestFile will be created in the current working directory on the remote FTP server. 

When ADestFile contains an empty string, the file name in ASourceFile (without path information) is used as the destination file name for the data transfer. 

An EIdFTPUploadFileNameCanNotBeEmpty exception is raised if Put is called using an empty string in the ADestFile argument. 

Put triggers the OnBeforePut event handler when it has been assigned for the FTP client. 

Put uses the value in the AApend argument to determine the correct FTP command to use for the data transfer. When AAppend contains True, the FTP server will append data from the transfer to the end of a file which already exists on the FTP server. using the FTP APPE command. When AAppend is False, the data from ASource or ASourceFile overwrites any existing values in ADestFile using the FTP STOR command. 

During execution, Put triggers execution of the OnStatus event handler using values that indicates then the transfer is starting, has been completed, or has been aborted. 

Put creates, initializes, and maintains the data channel used to perform the data transfer based on the values in the Passive, UsingExtDataPort, and TransferMode properties. 

When Passive contains False, the values in DataPort, DataPortMin, and DataPortMax are also used to bind listen for the active server connection for the data channel. 

Put triggers the OnDataChannelCreate event handler after creating (but prior to connecting) the data channel. 

During transmission, Put uses the current value in the TransferMode property to determine if the Compressor property is used perfrom "Deflate" compression for values written on the IOHandler for the data channel. The value dmDefalte indicates that MODE Z is used for the data transfer. 

Put triggers the OnDataChannelDestroy event handler after closing (but prior to freeing) the data channel. 

Put triggers the OnAfterPut event handler when it has been assigned for the FTP client. 

Use Abort to cancel an executing data transfer request. 

Use KillDataChannel to force the data channel for the FTP session to be closed.

Discuss enabling LargeStream support in IOHandlers using OnDataChannelCreate

Exceptions 
Description 
With the message RSFTPFileNameCanNotBeEmpty when the destination file name is empty. 
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.