Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# winscp upload file

  				var tofile = new FileInfo(sourceFile).Name;
                // Setup session options
                SessionOptions sessionOptions = new SessionOptions
                {
                    Protocol = Protocol.Sftp,
                    HostName = ftphostname,
                    UserName = login,
                    Password = password,
                    SshHostKeyFingerprint = ftpkey
                };

                using (Session session = new Session())
                {
                    // Connect
                    session.Open(sessionOptions);
                    var ftpFile = uploadDir + "/" + tofile;
                    session.PutFiles(sourceFile, ftpFile, true).Check();
                }
 
PREVIOUS NEXT
Tagged: #winscp #upload #file
ADD COMMENT
Topic
Name
3+8 =