Solved

Delphi FTP component

Posted on 2000-04-07
9
1,726 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 2 77
Dynamically Created Query 3 69
How to save the image in the .cds File ClientDataSet? 1 28
Is there any way to treat Lock record in table with clientdataset? 3 31
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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