答案 0 :(得分:-1)
也许我认为您正在尝试将图像文件上传到FTP 本准则适合您
您必须克隆FTP Web请求
FtpWebRequest request =(FtpWebRequest)WebRequest.Create(“ftp://www.yourftp.com”);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(“username”,“password”);
string flepath =“Locationoffile”;
FileStream stream = File.OpenRead(filePath);
byte [] buffer = new byte [stream.Length];
stream.close();
request.ContentLength = buffer.Length;
Stream requestsream = request.GetRequestStream();
requestStream.Write(缓冲液,0,buffer.Lenght);
requestStream.Close();
FtpWebResponse response =(FtpWebResponse)request.GetResponse();
response.Close();