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();
}