Hey guys, I got this code to upload an FTP file which works great, but what do I do when I wnat to upload the contents of an entire folder? I mean, I could make a for-each but that would mean disconnecting and reconnecting to the FTP server alot of times which is just uneccesary. Any ideas?
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.blabla.com/mybackups.zip"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("user", "pass")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes("c:\mybackups.zip")
Dim strz As System.IO.Stream = request.GetRequestStream()
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()