This project is read-only.

SFTP: Uploading Files to the FTP Server has Inconsistent Behavior

Apr 4, 2013 at 9:23 AM
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))
        string FilePath = "D:\\CurrentTask\\in\\new.txt";                                         
        string remoteFileName = "/folderName/filename.txt";

        Stream fs = File.OpenRead(FilePath);                
        sftp.UploadFile(fs, remoteFileName);

Could you help me to resolve this issue?

Thanks in Advance.
Apr 4, 2013 at 4:38 PM

Do you upload to SFTP of FTP server?

Apr 8, 2013 at 9:59 AM
Edited Apr 8, 2013 at 1:22 PM
Hi Oleg,

Yes, i am uploading to the SFTP Server(s using the above code.

May 13, 2013 at 12:52 PM
Im trying to upload file from my local to unix platform using sftp...any suggestions?? is this powershell script ????