我正在设置新的FTP服务器,并且在我的uploadfile
函数中:FTPWebRequest.GetRequestStream()
引发异常:
错误550文件不可用
文件名包含非英语字符(例如阿拉伯字符)时。
我尝试上传仅包含英文字符的文件,它可以正常工作。
有人可以帮我吗?
这是我正在使用的代码的简短版本:
System.Net.FtpWebRequest UploadFTPRequest = null;
string URI = Hostname + target;
UploadFTPRequest = GetRequest((URI));
UploadFTPRequest.Method =
System.Net.WebRequestMethods.Ftp.UploadFile;
UploadFTPRequest.UseBinary = true;
UploadFTPRequest.ContentLength = fi.Length;
UploadFileInfo = fi;
const int BufferSize = 2048;
byte[] content = new byte[BufferSize - 1 + 1];
int dataRead;
using (UploadFileStream = fi.OpenRead())
{
try
{
//Exception error 550
UploadStream = UploadFTPRequest.GetRequestStream();
}
}