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”
谢谢大家,急求
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
你的服务器哎,本人怎么可能知道正确路径是什么
20
你确定你那个路径所在的电脑 有装ftp?