Topic Path: Symbol Reference > Classes > TIdFTP Class > TIdFTP Methods > VerifyFile Method > VerifyFile Method (TIdStream, String, Int64, Int64)
TIdFTP.VerifyFile Method (TIdStream, String, Int64, Int64)

Compares all or part of the specified local and remote files for verified transfer integrity.

function VerifyFile(
    ALocalFile: TIdStream; 
    const ARemoteFile: String; 
    const AStartPoint: Int64 = 0; 
    const AByteCount: Int64 = 0
): Boolean; overload;
Stream with the content for the local file.
Name of the file on the remote FTP server.
Initial position for comparing the local and remote files. Default value is 0.
Number of bytes to use for the checksum calculation. Default value is 0. 

Boolean - True when the local and remote files are the same.

VerifyFile is an overloaded method used to compare all or part the contents of the specified local and remote files as part of the extensibility features for verified transfer integrity. 

VerifyFile can be used to determine the integrity of a file transfer using one of the following checksum algorithms: 


SHA-1 checksum 
MD5 checksum 
CRC-32 checksum 


One of the algorithms must be listed in the Capabilities for the FTP server, or VerifyFile cannot determine the checksum value on the remote FTP server. 

VerifyFile selects the algorithm using the following preferred order: 




Internally, VerifyFile uses an instance of TIdHashMessageDigest5, TIdHashSHA1, or TIdHashCRC32 to calculate the checksum value for the contents of the local file using the ALocalFile argument. 

AStartPoint indicates the initial position in the files to use when calculating the checksum values. When AStartPoint contains 0 (zero) or a positive Integer value, the stream in ALocalFile is positioned to to that location prior to starting the checksum calculation. 

AByteCount indicates the number of bytes to include when performing the checksum calculation. The default value is 0, and indicates that the byte count should be derived from the size of the stream for the local file and the initial position indicated in AStartPoint. 

VerifyFile builds and sends an FTP command using an algorithm name and arguments as required for the operation. The checksum value from the remote FTP server is captured and compared to the value calculated for the local file. VerifyFile returns True when the local checksum and the remote checksum values are the same. VerifyFile returns False when the checksum values are not the same, or when the capability is not supported on the remote FTP server. 

Use SupportsVerification to determine if the FTP server support the extensibility feature.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.