Esempio n. 1
0
 private void SftpUpload(string filename, string foldername3,string uppath) 
 {
     string localpath=savepath+"\\"+foldername3+"\\"+filename;
     SFTPHelper SFTP = new SFTPHelper(UPserverIP, UPusername, UPpassword);
     try 
     {
         SetText("成功连接服务器,尝试上传" + filename + "\r\n");
         if (SFTP.Put(localpath, uppath+filename))
         {
             SetText(filename + "上传成功\r\n");
             SFTP.Disconnect();
         }
         else
         {
             SetText(filename + "上传失败\r\n");
         }
     }
     catch (Exception ex)
     {
         SetText("出现错误:" + ex.ToString() + "\r\n");
     }
 }