title: Upload file to FTP using C#
body: <p>I try upload a file to an FTP-server with C#. The file is uploaded but with zero bytes.</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {
      var dirPath = @"C:/Documents and Settings/sander.GD/Bureaublad/test/";
  
      ftp ftpClient = new ftp("ftp://example.com/", "username", "password");
  
      string[] files = Directory.GetFiles(dirPath,"*.*");
  
      var uploadPath = "/httpdocs/album";
  
      foreach (string file in files)
      {
          ftpClient.createDirectory("/test");
  
          ftpClient.upload(uploadPath + "/" + Path.GetFileName(file), file);
      }
  
      if (string.IsNullOrEmpty(txtnaam.Text))
      {
          MessageBox.Show("Gelieve uw naam in te geven !");
      }
  }
  </code></pre>