I have seen dozens of examples when trouble shooting this issue using the library in the title. The common example I am seeing that SHOULD work is:
string destinationPath = PathInfo.FileNameConvention;
using (FileStream fileStream = File.OpenRead(sourcePath))
{
using (Stream ftpStream = FTPClient.OpenWrite(string.Format("'{0}'", destinationPath), FtpDataType.ASCII))
{
fileStream.CopyTo(ftpStream);
}
}
When I do this code, I get a name length error on the ftpTrace log. When I use only the destination path, I get a time out error. I am sending to a mainframe MVS OS. I can connect in and log in just fine. able to submit site commands via the ftpclient.execute method. I tried, out of curiosity, to submit a put command via the execute method as well and got unknown command for put. Anyone having this issue too?
Also the connection works fine as I have manually submitted a file via cmd prompt ftp and was successful.
Some background information, the OpenWrite method of the library sends a STOR command using the path sent in and will default to binary type.