codice:Private Sub dUpload1() If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(Host1), System.Net.FtpWebRequest) request.Credentials = New System.Net.NetworkCredential(Username, Password) request.Method = System.Net.WebRequestMethods.Ftp.UploadFile Dim file() As Byte = System.IO.File.ReadAllBytes(OpenFileDialog1.FileName) Dim strz As System.IO.Stream = request.GetRequestStream() strz.Write(file, 0, file.Length) strz.Close() strz.Dispose() End If End Sub

Rispondi quotando