How can i make it so that if user presses button he would be able to upload file in project folder "music" by dragging the file or choosing it in file dialogue
private void textBox1_TextChanged(object sender, EventArgs e)
{
string path = textBox1.Text;
string filename = path.Substring(path.LastIndexOf(@"\"), path.Length - path.LastIndexOf(@"\"));
File.Copy(path, AppDomain.CurrentDomain.BaseDirectory + @"\" + filename);
}
it is not what i want it to be but i tried...
It looks like you are working with WPF or Winform. Based on the description and code, you want to load some file to work with. You can do that with OpenFileDialog() and can be used like:
private void LoadImage()
{
ofd = new OpenFileDialog();
ofd.Filter = "Image Files (JPG,JPEG,PNG,TIFF)|*.JPG;*.JPEG;*.PNG;*.TIFF";
if (ofd.ShowDialog() == true)
{
importPath = ofd.FileName;
}
}
So in this case you open a new dialog, add the expected formats, and after you selected the file you can get the path. You can find more info about it: https://wpf-tutorial.com/dialogs/the-openfiledialog/