NET 上传图片到服务端不用fileLoad

.Net技术 码拜 8年前 (2016-05-24) 1220次浏览
FileInfo fileInf = new FileInfo(images);
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(@”bimages” + images));
reqFTP.Credentials = new NetworkCredential(“user”, “password”);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(@”bimages” + images));无效的 URI: 未能确定 URI 的格式。
应该怎么样改路径为 “http://localhost:88//images”
谢谢大家,急求
解决方案

20

引用:
Quote: 引用:

哪有路径2个斜杠的

这是本人发布的一个服务端路径,就是要知道怎么样改?

你的服务器哎,本人怎么可能知道正确路径是什么

20

你确定你那个路径所在的电脑 有装ftp?

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明NET 上传图片到服务端不用fileLoad
喜欢 (0)
[1034331897@qq.com]
分享 (0)