In the past two days, I applied openfiledialog and used the upload function. When I opened the page, a series of operations were far from being implemented by the Asp.net upload control, however, learning is quite useful. The following is a simple application.
// Click the event private void button#click (Object sender, eventargs E) in the browser button) {try {// only the database file openfiledialog1.filter = "database file | *. DB "; if (openfiledialog1.showdialog () = dialogresult. OK) // get import {// when you click the Browse button, rotate the file path filename = openfiledialog1.filename; // put the obtained path in the text box textbox1.text = filename; // obtain the selected file name string name = filename. substring (filename. lastindexof ('\') + 1);} else return;} catch (exception ex) {msgbox. err ("reading data is incorrect. Please check the file to read data again ");}}View code