Upload file without using file upload control
-
I want to use file upload in my website, without using file upload control. I have used an asp textbox & an asp button. On clicking the button, the path of the file to be uploaded, comes in text box. Now, how can I upload the file whose path is there in the text box. Code that I used till now for button click is given below: protected void btnUpload_Click(object sender, EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "C# Corner Open File Dialog"; fdlg.InitialDirectory = @"c:\"; fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"; fdlg.FilterIndex = 2; Thread stathread = new Thread(new ThreadStart(() => fdlg.ShowDialog())); stathread.SetApartmentState(ApartmentState.STA); stathread.IsBackground = true; stathread.Start(); stathread.Join(); txtUpload.Text = fdlg.FileName; }
-
I want to use file upload in my website, without using file upload control. I have used an asp textbox & an asp button. On clicking the button, the path of the file to be uploaded, comes in text box. Now, how can I upload the file whose path is there in the text box. Code that I used till now for button click is given below: protected void btnUpload_Click(object sender, EventArgs e) { OpenFileDialog fdlg = new OpenFileDialog(); fdlg.Title = "C# Corner Open File Dialog"; fdlg.InitialDirectory = @"c:\"; fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"; fdlg.FilterIndex = 2; Thread stathread = new Thread(new ThreadStart(() => fdlg.ShowDialog())); stathread.SetApartmentState(ApartmentState.STA); stathread.IsBackground = true; stathread.Start(); stathread.Join(); txtUpload.Text = fdlg.FileName; }