file browsed using openfiledialog. how to move it to another path specified?

Posted by Anishabathija under C# on 1/3/2013 | Points: 10 | Views : 966 | Status : [Member] | Replies : 1
hey ,
I have browsed a file using openfiledialog control,
the code is as below:
private void btnBrowse_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
txtFile.Text = openFileDialog1.FileName;
//File Selected is shown in textbox

}

}
Now I have another button submit
private void btnSubmit_Click(object sender, EventArgs e)
{
if(openFileDialog1.CheckFileExists)

{
//string SelectedFile = openFileDialog1.FileName;
Stream str = openFileDialog1.OpenFile();
StreamReader Sr = new StreamReader(str);



string fileName = "C:\Users\Anisha\Desktop\folder\INPUT.txt";



string dirName = Path.GetDirectoryName(fileName);
}

I want to move the browsed file to the above path ?
How could i do that.. please help... urgent !!




Responses

Posted by: Guna27 on: 1/3/2013 [Member] Starter | Points: 25

Up
0
Down
Try this Code......

File.Move(openFileDialog1.FileName,"D:\\myFile.txt");

Guna..............

Anishabathija, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response