Solved

Delphi FTP component

Posted on 2000-04-07
9
1,701 Views
Last Modified: 2012-06-27
Does anyone know where I can find documentation on Delphi's FTP control?
I need to connect via FTP, navigate and put files (standard FTP stuff I guess!) but Delphi Help doesn't say much about it at all.

Cheers
0
Comment
Question by:sparkido
9 Comments
 
LVL 4

Expert Comment

by:jeurk
ID: 2692774
I suggest you use the components found on http://www.pbe.com/winshoes/ they are the best you can find.
the components are free and open source and very easy to use.
They is a sample that show how to do ftp stuff...
Let me know if I can help more on that ...
0
 

Expert Comment

by:sarc
ID: 2692781
Wich version of Delphi are you using? At D5 the "TNMFTP" has a really good help. (By the way - as as an alternative I suggest Francois Piette's ISC - it has a nice FTP-Component - and is free with sourcecode - that often helps...) Here are some of the basic functions you will need (if you are using the TNMFTP-Component):

constructor Create(AOwner: TComponent);
property UserID: string;
property Password: string;
property Host: String;  // name/ip of host to connect
property Port: Integer; // port you want to use
procedure Connect; // Connect now

procedure ChangeDir(DirName: string);

property ParseList: boolean; // auf true setzen vorm Dir-einlesen
procedure List; // Veranlaßt das einlesen des aktuellen Directories

Wurde das Directory eingelesen, stehen die Ergebnisse in:
property FTPDirectoryList: TFTPDirectoryList;

Diese kann dann einfach ausgelesen werden (jedes der Elemente ist eine vollwertige Stringliste - die Anzahl der Elemente bekommt man also z.B. über : FTPDirectoryList.name.count)

FTPDirectoryList.name[i];
FTPDirectoryList.modifdate[i];
FTPDirectoryList.attribute[i];
FTPDirectoryList.Size[i];


procedure Download(RemoteFile, LocalFile: string); // upload entsprechend

Hilfreich ist manchmal:
property CurrentDir: string;

Wenn ich hiermit nicht so richtig getroffen habe, dann schreib mir mal einfach genauer, was Du brauchst...

greetz
Carsten
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2692785
the standard ftp component with delphi is called "nmftp" just put it on your form, its very easy to use....

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Psock, NMFtp;

type
  TForm1 = class(TForm)
    NMFTP1: TNMFTP;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure NMFTP1Connect(Sender: TObject);
    procedure NMFTP1ConnectionFailed(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  nmftp1.host:='ftp.xoom.com';
  nmftp1.password:='xxx';
  nmftp1.UserID:='whoever';
  nmftp1.connect;
    //The Events Now Say Whats Going On...
end;

procedure TForm1.NMFTP1Connect(Sender: TObject);
begin
   //Label1.caption:='Connected!';
     //Now Upload A File...
//  NMFTP1.Upload('c:\tosend\file.zip', 'file.zip');

end;

procedure TForm1.NMFTP1ConnectionFailed(Sender: TObject);
begin
//label1.caption:='Failed';
end;

end.
0
 

Expert Comment

by:sarc
ID: 2692791
Hups... wrong language ;-)

Comments here in english again...
(TNMFTP is the FTP component delivered with D5)


constructor Create(AOwner: TComponent);
property UserID: string;
property Password: string;
property Host: String;  // name/ip of host to connect
property Port: Integer; // port you want to use
procedure Connect; // Connect now

procedure ChangeDir(DirName: string);

property ParseList: boolean; // set to true before reading a dir
procedure List; // read the actual dir

If you called "List" you find the results in:
property FTPDirectoryList: TFTPDirectoryList;

You can easyly access this list. each of its subelements is a StringList:

FTPDirectoryList.name[i];
FTPDirectoryList.modifdate[i];
FTPDirectoryList.attribute[i];
FTPDirectoryList.Size[i];


procedure Download(RemoteFile, LocalFile: string); // upload the same

Sometimes helpful:
property CurrentDir: string;

If you need more info - or it was another component you are using, tell me, I'll try to help if I can, but I need more info.

greetz
Carsten
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:sparkido
ID: 2692976
Sorry guys, should have been more specific. I am using the TFTP control you get with Delphi 3.
0
 
LVL 1

Accepted Solution

by:
mscatena earned 50 total points
ID: 2693067
Forget this Delphi 3 junk. It's a complete waste of time. If there were a contest for the worst component suite ever, the Internet components in Delphi 2.01/3 would have my vote. Its amazing that Borland had the nerve not only to put that garbage on Delphi 2.01 but still kept this piece of (four letter word) in Delphi 3.

The components in Delphi 4 and 5 are better (how could they NOT be?) but still barely usable.

Go get the free Winshoes (http://www.pbe.com/winshoes/) or the shareware ones at www.argosoft.com (better yet).

0
 

Expert Comment

by:sarc
ID: 2693247
Hi!

Same comment from me, too... The components in D3 are really a bit(????) horrible. If you still want I can try to explain them a bit, but I (too) recommend a freeware component - where I prefer ISC (Internet Component Suite) from F. Piette - available from nearly each Delphi Ressource Server (Delphi Superpage for example). It has an FTP Server and an FTP Client component and is quite easy to use (MUCH MUCH more easy than the D3-Components - and MUCH MUCH more stable).

greetz
Carsten
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2694308
try FPiette's FREE components: www.rtfm.be/fpiette/indexuk.htm
it has an FTP component which is great, comes with full source and examples
0
 
LVL 4

Expert Comment

by:jeurk
ID: 2699623
hello sparkido,
Why is mscatena's answer accepted ?
just curious...
CU
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now