我有这个
link的工作代码,将文件上传到ftp站点:
原文链接:https://www.f2er.com/vb/255500.html' set up request... Dim clsRequest As System.Net.FtpWebRequest = _ DirectCast(System.Net.WebRequest.Create("ftp://ftp.myserver.com/test.txt"),System.Net.FtpWebRequest) clsRequest.Credentials = New System.Net.NetworkCredential("myusername","mypassword") clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile ' read in file... Dim bFile() As Byte = System.IO.File.ReadAllBytes("C:\Temp\test.txt") ' upload file... Dim clsStream As System.IO.Stream = _ clsRequest.GetRequestStream() clsStream.Write(bFile,bFile.Length) clsStream.Close() clsStream.Dispose()