Hello everybody,
I have developped a web application which should upload files to a Ftp server.
But I didn't succeed these uploads.
I use a Ftp command file : Ftp_Upload.bat :
ftp -n -i -s:"C:\Essai_Ftp\ftp_cmd.txt">"C:\Essai_Ftp\ftp.log"
</code>
Ftp file ftp_cmd.txt :
OPEN 100.100.100.100user usr_essaipwd_essaibinarycd dir_essaimput "C:\Essai_Ftp\*.doc"quit
public void Send_Ftp() {
Process oProc = new Process();
ProcessStartInfo oInfo = new ProcessStartInfo();
string sFtpCommandFile = "c:\\Essai_Ftp\\Ftp_Upload.bat"; oInfo.FileName = sFtpCommandFile; oInfo.UseShellExecute = false; oInfo.WindowStyle = ProcessWindowStyle.Hidden;
oProc.StartInfo = oInfo; oProc.Start(); oProc.WaitForExit(); }
Here is the Ftp log file when I run the C# code :
ftp> Connecté à 100.100.100.100OPEN 100.100.100.100220 ESSAI1ftp> user usr_essai331 User usr_essai, password please
230 Password Ok, User logged inftp> binary200 Type Binaryftp> cd dir_essai250 Change directory okftp> ftp> mput "C:\Essai_Ftp\*.doc"200 Port command received425 Unable to open the data connection200 Port command received425 Unable to open the data connection200 Port command received425 Unable to open the data connection200 Port command received425 Unable to open the data connectionftp> ftp> quit221
On the other hand, when I run this command file (Ftp_Upload.bat) manually, the files are correctly uploaded.
And the code works correctly when I disable the Windows firewall (I am in Windows 7).
But I cannot let the Windows firewall disabled for security reasons.
Do you have an idea ?
Thanks a lot in advance.
Eric.