Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: File upload failing - need help

$
0
0
Where????
    static void Main(string[] args)
    {
        string host = "*.*.*.*";
        string username = "test";
        string password = "********";



        string localFileName = "C://TEST.CSV";
        string remoteFileName = System.IO.Path.GetFileName("t.CSV");



        Console.ReadLine();

        SshClient sshClient = new SshClient(host, 22, username, password);
        sshClient.Connect();
        using (var sftp = new SftpClient(sshClient.ConnectionInfo))
        {

            sftp.Connect();

            using (var file = File.OpenRead(localFileName))
            {

                sftp.UploadFile(file, remoteFileName);
            }

            sftp.Disconnect();
        }
    }

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>