I have tested your code and it works perfectly from here.
Here is the log using YOUR code and ICS-V7 updated form SVN repository right now:

< 220-FileZilla Server version 0.9.24 beta
< 220 Micro$oft free
USER fpiette
< 331 Password required for fpiette
PASS ***********
< 230 Logged on
CWD .
< 250 CWD successful. "/" is current directory.
TYPE I
< 200 Type set to I
PASV
< 227 Entering Passive Mode (193,200,60,61,8,1)
! Upload Size 45
STOR DeleteMe.txt
< 150 Connection accepted
< 226 Transfer OK
! 45bytes received/sent in 62 milliseconds
QUIT
< 221 Goodbye

Regards,
--
francois.pie...@overbyte.be
http://www.overbyte.be


----- Original Message ----- From: "Fabrice Vendé" <techni...@infocob.com>
To: <twsocket@elists.org>
Sent: Tuesday, May 10, 2011 11:49 AM
Subject: [twsocket] TFtpCli and FTP server in passive mode


Hello,

I have a problem to upload a file on some server which are only reachable in passive mode. Tested with a lot of version of ICS (V7, octobre 2010, V6 octobre 2009) and on Delphi 2006, 2007, 2010.

In passive mode with Ftpclient.passivemode:=true; command "put" (same with "get") seems to be ignored.

I only do this :
procedure TForm8.icsClick(Sender: TObject);
begin
   FtpClient1.HostName:=site.text;
   FtpClient1.username:=login.text;
   FtpClient1.password:=password.text;


   FtpClient1.connect;
   FtpClient1.HostDirName     :='.';
   FtpClient1.cwd;


    FtpClient1.LocalFileName    :='h:\test.txt';
    FtpClient1.HostFileName    :='test.txt';

    FtpClient1.TypeBinary;

    FtpClient1.Passive:=true;
    FtpClient1.put;
    FtpClient1.Quit;

end;

Log returned by TFtpClient (useing TftpClient events) is :

< 220-FileZilla Server version 0.9.37 beta
< 220-written by Tim Kosse (tim.ko...@gmx.de)
< 220 Please visit http://sourceforge.net/projects/filezilla/
USER auser
> USER auser
< 331 Password required for auser
PASS apass
> PASS apass
< 230 Logged on
CWD .
> CWD .
< 250 CWD successful. "/" is current directory.
TYPE I
> TYPE I
< 200 Type set to I
PASV
> PASV
< 27 Entering Passive Mode (213,56,128,2,4,27)
QUIT
> QUIT
<
221 Goodbye


In active mode without the line "FtpClient1.Passive:=true;" I Have :


< 220-FileZilla Server version 0.9.37 beta
< 220-written by Tim Kosse (tim.ko...@gmx.de)
< 220 Please visit http://sourceforge.net/projects/filezilla/
USER auser
> USER auser
< 331 Password required for auser
PASS apass
> PASS apass
< 230 Logged on
CWD .
> CWD .
< 250 CWD successful. "/" is current directory.
TYPE I
> TYPE I
< 200 Type set to I
PORT 192,168,1,13,195,101
> PORT 192,168,1,13,195,101
< 200 Port command successful
! Upload Size 2,08K
STOR test.txt
> STOR test.txt
< 150 Opening data channel for file transfer.
< 425 Can't open data connection.
! STOR Failed
QUIT
> QUIT
< 221 Goodbye


I get an error 425 "Can't open data connection." !

So how to set passive mode and upload a file ?
What I have missed ?
Command like FtpClient1.dele works fine

This FTP server work fine with a Filezilla client.

Best regards,

-
Fabrice
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to