Re: D7/Indy - download a file



"Tom" <none@xxxxxxxx> wrote in message
news:435ff567@xxxxxxxxxxxxxxxxxxxxxxxxx
>I know how to use Indy for ftp or html access.
>
> How do I use it to download a file (to disk) at, say,
> www.domainname.com/filename.ext

This works for me:

procedure TForm1.BitBtn1Click(Sender: TObject);
const
sFullPath = 'TheEnd/Of/The/Innocents.mdb';
var
ResultStream: TFileStream;
begin
Screen.Cursor := crHourglass;
try
ResultStream := TFileStream.Create('Innocents.mdb', fmCreate);
try
IdFTP.Host := 'www.DesertRoseBand.cr';
IdFTP.Username := 'chillman';
IdFTP.Password := 'byrds';
IdFTP.Connect;
IdFTP.Login;
IdFTP.Get(sFullPath, ResultStream, True);
IdFTP.Disconnect;
finally
ResultStream.Free;
end;
finally
Screen.Cursor := crDefault;
end;
end;

--

Download the latest draft (version 1.23, updated 10/2/2005) of
"STILL CASTING SHADOWS: Two American Families 1620-2006"
by Blackbird Crow Raven: http://cc.borland.com/ccweb.exe/listing?id=23106


.