//delphi 获取网络文件大小
function GetUrlFileSize(aURL: string): integer;
var
FileSize: integer;
var
IdHTTP: TidHttp;
begin
IdHTTP:= Tidhttp.Create(nil);
IdHTTP.Head(aURL);
FileSize := IdHTTP.Response.ContentLength;
IdHTTP.Disconnect;
Result := FileSize;
end;
//delphi 获取本地文件大小
function getFileSize(FileName:string):Longint;
var SearchRec: TSearchRec;
begin
if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then
Result := SearchRec.Size
else
Result := -1;
end;
关键字词: