__Method Name:__ UploadFile()
__Issue:__ Files Uploaded to FTP Server has Inconsistent Behavior
I am trying to upload the file from local path to the ftp server, there is no exceptions in the uploadFile() method , but most of the times files were not uploaded and few times empty file was being uploaded.
Here is my code for uploading a file to the server:
using (var sftp = new SftpClient(sftpHost, user, password))
{
sftp.Connect();
string FilePath = "D:\\CurrentTask\\in\\new.txt";
string remoteFileName = "/folderName/filename.txt";
Stream fs = File.OpenRead(FilePath);
sftp.UploadFile(fs, remoteFileName);
sftp.Disconnect();
}
Could you help me to resolve this issue?
Thanks in Advance.
Comments: ** Comment from web user: drieseng **
__Issue:__ Files Uploaded to FTP Server has Inconsistent Behavior
I am trying to upload the file from local path to the ftp server, there is no exceptions in the uploadFile() method , but most of the times files were not uploaded and few times empty file was being uploaded.
Here is my code for uploading a file to the server:
using (var sftp = new SftpClient(sftpHost, user, password))
{
sftp.Connect();
string FilePath = "D:\\CurrentTask\\in\\new.txt";
string remoteFileName = "/folderName/filename.txt";
Stream fs = File.OpenRead(FilePath);
sftp.UploadFile(fs, remoteFileName);
sftp.Disconnect();
}
Could you help me to resolve this issue?
Thanks in Advance.
Comments: ** Comment from web user: drieseng **
Would it be possible to provide more details ?