title: Upload file to FTP site using VB.NET
body: <p>I have this working code from this <a href="http://www.vbforums.com/showthread.php?t=468649" rel="noreferrer">link</a>, to upload a file to an ftp site:</p>
  
  <pre><code>' 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, 0, bFile.Length)
  clsStream.Close()
  clsStream.Dispose()
  </code></pre>
  
  <p>I wonder, if the file already exists in the ftp directory, the file will be overwritten?</p>