簡體   English   中英

ftp上傳錯誤:“不支持給定路徑的格式。”

[英]ftp upload error : “The given path's format is not supported."

我可以從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();

如果您使用一個“ /”而不禁用轉義序列,則字符串將無法正確解釋。
嘗試一下

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

要么

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

您可以在這里閱讀更多有關轉義序列的信息

我相信您的本地目錄變量中還有一個空格:

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

更改為

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM