Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#8

AW: indy idHttp + file download

  Alt 28. Nov 2010, 22:10
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  FileList := TStringList.Create;
  try
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB.zip');
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB_nonVCL.zip');
    FileList.Add('kdvndk');
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AudioPlayer.zip');
    for i := 0 to FileList.Count - 1 do
    begin
      try
        Download(i);
      except
        on E: EIdReadTimeOut do
        begin
          Memo1.Lines.Add(E.Message);
          Continue;
        end;
      end;
    end;
  finally
    FileList.Free
  end;
end;

procedure TForm1.Download(index: Integer);
begin
  IdHTTP1.Head(FileList[index]);
  Memo1.Lines.Add(IntToStr(IdHTTP1.Response.ContentLength));
end;
Just to show you the main principle.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat