Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: FTP a File
| Subject: | Re: FTP a File |
| Posted by: | "Barry Wood" (bar..@amss.uk.com) |
| Date: | Thu, 4 May 2006 19:16:53 |
Francois
I'll give this a go - anything to make life simpler ...
Barry
"Francois Piette [ICS & Midware]" <francois.piette@overbyte.be> wrote in
message news:4459c9fb$1@newsgroups.borland.com...
>> Being pretty new to ftp'ing I get confused with all the stuff that's
>> available. I need to start with a simple example and then I can work from
>> there.
>>
>> Does anybody have some code that would enable me to ftp a small file up
>> to
>> an ftp server? I have all the ftp info etc and can easily do this via the
>> cmd window. It would be nice to do it from code.
>
> Using ICS (http://www.overbyte.be), create a new project, drop a button
> and
> a memo on the main form.
> Assign the events as below, then run.
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> FtpClient1.HostName := 'ftp.borland.com';
> FtpClient1.HostDirName := 'pub/delphi/devsupport/general';
> FtpClient1.HostFileName := 'index.txt';
> FtpClient1.UserName := 'anonymous';
> FtpClient1.PassWord := 'tom@company.com';
> FtpClient1.LocalFileName := 'c:\temp\index.txt';
> FtpClient1.ReceiveAsync; // Or Receive if you want to be blocking
> end;
>
> procedure TForm1.FtpClient1Display(Sender: TObject; var Msg: String);
> begin
> Memo1.Lines.Add(Msg);
> end;
>
> procedure TForm1.FtpClient1RequestDone(Sender: TObject;
> RqType: TFtpRequest; ErrCode: Word);
> begin
> Memo1.Lines.Add('Done ' + IntToStr(ErrCode));
> end;
>
>
> --
> Contribute to the SSL Effort.
> Visit http://www.overbyte.be/eng/ssl.html
> --
> francois.piette@overbyte.be
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
none