2014-09-25 155 views
0

我可以下載一個沒有任何FTP問題的文件,但是不能從FTP上傳一個文件到本地,我已經把它改成了黑色和正斜線,仍然有同樣的錯誤。ftp上傳錯誤:「給定路徑的格式不被支持」

string _ftpURL = @"192.168.0.134"; 
string _UserName = "root"; //User Name of the SFTP server 
string _Password = "porter"; //Password of the SFTP server 
int _Port = 2222; //Port No of the SFTP server (if any) 
string _ftpDirectory = "/home/root/systools/WM"; //The directory in SFTP server where the files will be uploaded 
string LocalDirectory = " E:\\charan\\final test\\WebMobility.db"; //Local directory from where the files will be uploaded 
Sftp Connection = new Sftp(_ftpURL, _UserName, _Password); 
Connection.Connect(_Port); 
**Connection.Put(LocalDirectory, _ftpDirectory);** 
Connection.Close(); 

回答

0

我相信你在你的本地目錄變量的addional空白:

string LocalDirectory = " E:\\charan\\final test\\WebMobility.db"; 

將其更改爲

string LocalDirectory = "E:\\charan\\final test\\WebMobility.db"; 
+0

謝謝fnupp,那是錯誤... – 2014-09-25 09:59:19

0

如果你使用一「/」不禁止轉義序列,你的字符串將不能正確解釋。

string _ftpDirectory = @"/home/root/systools/WM"; 
試試吧

string _ftpDirectory = "//home//root//systools//WM"; 

你可以閱讀更多關於轉義序列here

+0

NO西弗它沒有幫助我。 – 2014-09-25 08:42:25

相關問題