Hi All,
I'm trying to create a custom file upload control in WPF 4.0 and I'm stuck in one point.
I'm not able to save file in my solution folder after browsing the file. Below code I'm using for Browsing
private void btnBrowse_Click(object sender, RoutedEventArgs e)
{
// Create OpenFileDialog
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.Filter = "Images (*.JPG;*.JPEG;*.PNG)|*.JPG;*.JPEG;*.PNG";
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
string filename = dlg.FileName;
FileNameTextBox.Text = filename;
}
}
private void btnUpload_Click(object sender, RoutedEventArgs e)
{
string filename = FileNameTextBox.Text;
// Now I want save this file to my image folder.
}
Now I want to save file in image folder which is inside my Solution explore. For ASP.NET we use Server.Mappath for mapping the specified relative or virtual path to the corresponding physical directory on the server. But I'm not sure what we can use in WPF for achieving the same thing. I'm new in WPF so please help me.