Is there any way I can get a file explorer to open up and allow the user to choose a folder destination in a website ? I want to then save this location and this will be the location for uploads.
Use the following code. Its working for me.
protected void browse_Click(object sender, EventArgs e) {
Thread thdSyncRead = new Thread(new ThreadStart(openfolder));
thdSyncRead.SetApartmentState(ApartmentState.STA);
thdSyncRead.Start();
}
public void openfolder()
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
DialogResult result = fbd.ShowDialog();
string selectedfolder = fbd.SelectedPath;
string[] files = Directory.GetFiles(fbd.SelectedPath);
System.Windows.Forms.MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
}
I recommended Roxy Fileman , it's free and simple to use in my experiences.
Hope you enjoy it :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.