Kosty_Fomin

Untitled

May 22nd, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1.  OpenFileDialog openFileDialog1 = new OpenFileDialog();
  2.             openFileDialog1.Filter = "CSV files (.csv)|*.csv";
  3.             openFileDialog1.FilterIndex = 1;
  4.  
  5.             if (openFileDialog1.ShowDialog() == DialogResult.OK) // Test result.
  6.             {
  7.                 try
  8.                 {
  9.                     string file = openFileDialog1.FileName;//reads path to file
  10.  
  11.                     NameValueCollection nvc = new NameValueCollection();
  12.                     HttpUploadFile("http://192.168.1.48:5001",
  13.                          file, "file", "file/csv", nvc);
  14.  
  15.  
  16.                 }
  17.  
  18.                 catch (Exception ex)
  19.                 {
  20.                     MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
  21.                 }
  22.             }
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment