Registriert seit: 30. Jan 2005
Ort: Münster
745 Beiträge
Delphi 3 Professional
|
Re: Größe einer Onlinedatei ermitteln
28. Mär 2005, 00:15
Hallo,

Zitat von moritz:
Falls du -1 zurück bekommst, wurde von der Seite keine Größenangabe gesendet.

Zitat von Chewie:
Eventuell....
Hast Du dein Ziel mit "IdHttp" erreicht?
sonst versuch es mal damit:
Delphi-Quellcode:
uses wininet;
Function InternetDateiByts( url: string): string;
var Session, thefile : hInternet;
index,codelen : Integer;
code : array[1..20] of char;
res : pchar;
begin
if pos(' http://',lowercase( url))=0 then url:=' http://'+ url;
Session:=InternetOpen(' InetURL:/1.0',INTERNET_OPEN_TYPE_PRECONFIG, nil, nil,0);
if assigned(session) then
begin
thefile:=InternetOpenUrl(session, pchar( url), nil, 0, INTERNET_FLAG_RELOAD,0);
Index:= 0;
CodeLen:= 10;
HttpQueryInfo(thefile, HTTP_QUERY_CONTENT_LENGTH, @code, codeLen, Index);
res:= pchar(@code);
if (res = ' 245') then res:= ' -1';
if assigned(thefile) then InternetCloseHandle(thefile);
end;
InternetCloseHandle(session);
GetInternetFileSize:= res;
end;
http://www.seite.de/datei.zip Größe = 5476 Byts  richtig
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
|
|
Zitat
|