Solved

Delphi FTP component

Posted on 2000-04-07
9
1,714 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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