Internet Direct (Indy)
Home
PreviousUpNext
TIdFTP.Size Method

Gets file size information from the FTP server.

Pascal
function Size(
    const AFileName: String
): Int64;
Parameters 
Description 
AFileName 
The file name on the remote file system. 

Integer - Size of the file, or -1 when unknown.

Size is an Integer function used to retrieve file size information for the file specified in AFilename from the FTP server. Size sends the FTP SIZE command using AFilename as an argument. 

The return value for the method is -1 when file size information for the file name specified in AFilename cannot be determined.

[Delphi]

  AFtp.ChangeDir('/public/images');

  iAvailable := GetDiskSpace('D:');
  iSize := AFtp.Size('image.jpg');

  if (iSize <> -1) and (iSize < iAvailable) then
  begin
  AFtp.Get('image.jpg', 'd:tempimage.jpg', True);
  end;
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.