title: How to save any type of files in a specific folder using file upload in WPF?
body: <p>I have a TextBox (txtDocUpload) and a Button. On the clicking of that button, an upload dialogue is opening and after uploading a file I have to save it in a particular folder.</p>
  
  <p>For opening the upload dialogue</p>
  
  <pre><code> private void txtBtnUpload_Click_1(object sender, RoutedEventArgs e)
      {
          OpenFileDialog openFileDialog = new OpenFileDialog();
          //openFileDialog.DefaultExt = ".txt";
  
          Nullable&lt;bool&gt; result = openFileDialog.ShowDialog();
          if (result == true)
          {
              filename = openFileDialog.FileName;
              txtDocUpload.Text = System.IO.Path.GetFileName(filename);
  
          }
      }
  </code></pre>
  
  <p>Clicking save button I have to save, and the code ("File1"is the location where i want to save the file).</p>
  
  <pre><code>string urlpath = "WoDocs";
  var path = @"~\" + urlpath + @"\" + WOMaintenance.GetAddressId.IDWorkOrderDetail;
  if (!Directory.Exists(path))
      Directory.CreateDirectory(path);
  
      var ext = System.IO.Path.GetExtension(txtDocUpload.Text);
      var pathURL=txtDocDescription.Text+ext;
      var file1 = System.IO.Path.Combine(path,txtDocDescription.Text + ext);
      //docFile1.SaveAs(file1);
  </code></pre>