Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use FTP component?

Posted on 1999-08-02
11
Medium Priority
?
195 Views
Last Modified: 2010-04-04
I've got Delphi 3 Client/Server and want to send/retrieve files to/from an FTP server. Can you please tell me which properties must be set and which methods must be called to establish the connection, to send/retrieve a file, and to close the connection.

Thank you,
Hamilton.
0
Comment
Question by:Hamilton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
11 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1392544
use the TNMFTP component... place it on your form, and then you have to set the host the password and UserID if you need that... (like to access geocities by ftp you'd need that password and userid it)... you should include the port number but it is usually 21 so don;t change that.... then use NMFTP1.Download('remotefile.txt', 'localfile.txt');

If you need an example I will show you how to do it!

..-=ViKtOr=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1392545
Anyways, here is an example..

procedure TForm1.Button1Click(Sender: TObject);
begin
     FTP.Host := 'ftp.webjump.com';
     FTP.UserID := 'myusername';
     FTP.Password := 'mypassword';
     FTP.Connect;
     FTP.Download('index.html', 'c:\windows\desktop\test.html');
     FTP.Disconnect;
end;

Hope this helps!!

..-=ViKtOr=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1392546
I will answer the question and let's hope that my comments have helped you. I've tried the code I gave  you on my own website and it saved the maind index.html to my desktop as a test.html.

..-=ViKtOr=-..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Hamilton
ID: 1392547
Hi victornet!

Very nice your code example, and it seems to be quite easy, but where can I get the component TNmFtp? My Borland Delphi 3 Client/Server does not include it.

Thanks a lot. Regards,
Hamilton.
0
 
LVL 17

Accepted Solution

by:
inthe earned 200 total points
ID: 1392548
the TNmFtp component is for delphi4 as you have delphi 3 you must use Tftp which is on the internet tab of your component pallet.it is made by the same people so the commands are similar though not the same.
you could also use the ftp component from the internet component suite by f.piette:
http://www.rtfm.be/fpiette/indexuk.htm

or you could use the simpleftp from the winshoes internet component suite:
http://www.pbe.com/SourceWorks/Winshoes/

the winshoes is my favorite  so here is an example of usage:
with SimpleFTP1 do begin
UserName := 'Barry';
Password := 'nottelling';
HostName := 'some_server';
Connect;
LocalDir := 'c:\Windows\Desktop';
RemoteDir:= '/my_dir_on_some_server';
PutFiles('*.zip');//or getfiles...
Disconnect;
end;

winshoes is also well supported and almost every second question on Borland.Public.Delphi.Internet is about them.
Regards Barry
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1392549
Here we go again. Barry, don't you think that my answer was right and he just needed the correct FTP component? I could've told him about TFTP or send him the TNMFTP compoent. I don't think that was fair playing from your site... I better stay of E-E because i just can't stand this anymore....

Ciao!....

..-=ViKtOr=-..
0
 

Author Comment

by:Hamilton
ID: 1392550
Hi viktornet,

I'm sorry that I may have made you so angry. But there's more than just replacing TNmFtp by TFtp. For example there isn't any similar method to "Download". I've found "SendDoc", "GetDoc", "SendFile", "SendDoc", etc., but in any case I obtained an exception that the connection is not in the correct state.

So it's not simply changing the component! Nevertheless, if it had been so easy I would not have needed to ask for any help ...

Regards,
Hamilton.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1392551
Hamilton, I'm not angry at all. As a matter of fact I've been laughing at my self all day long and am not angry at all. If I knew you didn;t have that component I could've send it to you. If not I could've told you about the TFTP and given you some sample code respectively. The thing is that I was sleeping at the time all this happened. I apologize if I've shown anything that makes you think I was angry.

..-=ViKtOr=-..
0
 

Author Comment

by:Hamilton
ID: 1392552
Hi inthe!

I've downloaded the component TSimpleFtp and tried your code with one of my sites on ftp.tripod.de. The PutFile(s) method worked immediately, but for downloading with GetFile(s) I needed to switch the TransferType to ttAscii. Do you know why? Otherwise, the component is very easy to handle.

Thanks a lot for all that,
Hamilton.
0
 

Author Comment

by:Hamilton
ID: 1392553
Hi viktornet!

I'm always looking forward to hearing that people are laughing at themselves. :-) And I know by myself that computer freaks have had work with holding their eyes open, having few sleep. :-))) So there's nothing to apologize!

Is it possible to me to give you some experts points although I've rejected your proposed answer?

Regards,
Hamilton.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1392554
No that's okay Hamilton. Just be careful when you grade next time. Other than that, just have fun with your ftp-ing...

..-=ViKtOr=-..
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

704 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