Dim createFTP As String = Convert.ToString(host & Convert.ToString("/")) & remoteFile ' Create an FTP Request ftpRequest = DirectCast(FtpWebRequest.Create(createFTP), FtpWebRequest) ' Log in to the FTP Server with the User Name and Password Provided ftpRequest.Credentials = New NetworkCredential(user, pass) 'ftpRequest.Credentials = New NetworkCredential(user, pass, createFTP) ' When in doubt, use these options ftpRequest.UseBinary = True ftpRequest.UsePassive = True ftpRequest.KeepAlive = True ' Specify the Type of FTP Request ftpRequest.Method = WebRequestMethods.Ftp.UploadFile ' Establish Return Communication with the FTP Server ftpRequest.Timeout = 600000 ftpRequest.ReadWriteTimeout = 600000 ' read in file... Dim bFile() As Byte = System.IO.File.ReadAllBytes(localFile) ' ftpStream = ftpRequest.GetRequestStream() ' Open a File Stream to Read the File for Upload Dim clsStream As System.IO.Stream = ftpRequest.GetRequestStream() clsStream.Write(bFile, 0, bFile.Length) clsStream.Close() clsStream.Dispose() ftpRequest = Nothing Catch ex As WebException MsgBox(ex.ToString()) End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)