FTPフォルダにファイルをアップロードしようとしていますが、次のエラーが表示されます。私はこれをテストするには、次のサンプルを使用しています名前に特殊文字を含むftpフォルダにファイルをアップロードする
The remote server returned an error: (550) File unavailable (e.g., file not found, no access)
:
私はではなく、ターゲットフォルダの親フォルダ01-03-2017
上のファイルをアップロードすることができる午前
// Get the object used to communicate with the server.
string path = HttpUtility.UrlEncode("ftp://host:port//01-03-2017/John, Doe S. M.D/file.wav");
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(path);
request.Method = WebRequestMethods.Ftp.UploadFile;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("user", "password");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader(@"localpath\example.wav");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();
- 明確に特殊文字を持ってい
ROLLINS, SETH S. M.D
それ。 - 私は
HttpUtility.UrlEncode
に試してみましたが、それはあなたの時間と助けを
感謝を助けていないFileZillaの
問題はURLにあります:「/」の代わりにすべてのフォルダ名の後に「@」を使用してください@Ankit – Prabu