I am using a free version of the library and MSVS2003 with C#. I am trying to right a small test program to upload a txt file from local dir to the doc server. Here is most of the code:
private void Button1_Click(object sender, System.EventArgs e)
{
string step = "";
FTPClient ftp = null;
try
{
step = "1";
ftp = new FTPClient();
ftp.RemoteHost = "xx.x.xx.xxx";
step += "2";
ftp.Connect();
step += "3";
ftp.Login("user???????", "pass???????");
step += "4";
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;
step += "5";
ftp.ChDir("PA");
step += "6";
if (ftp.IsConnected)
{
step += "7";
ftp.Put("C:/A-Temp/test.txt", "test.txt");
}
step += "8";
ftp.Quit();
step += "9";
}
catch ()
{
//----------------- Desplay message box ----------------
string strJScript11 = "<script type='text/javascript'>alert('" + step + "')</script>";
this.Controls.Add(new LiteralControl(strJScript11));
//======================== Fin =========================
}
}
I am able to MkDir so the connection is there.
This code stops at step 7 meaning the "ftp.Put("C:/A-Temp/test.txt", "test.txt"); generate an error.
Can someone help me with this. Thanks.