Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
 DialogResult result = openDialog1.ShowDialog();
  string fullpath = openDialog1.FileName;
  string extension = Path.GetExtension(fullpath);

  File.Copy(fullpath, @"C:\Users\Acer\Documents\Visual Studio 2010\Projects\sqlprocedure\sqlprocedure\Resources\Document\" + Filename + extension);

What I have tried:

I Am try with this but it take same file name same.
I also cant get the path where  copy file location File is save please help me.
Posted
Updated 20-Dec-16 21:49pm
v2

1 solution

you can use this to get full path.

C#
rfilename = openDialog1.InitialDirectory + openDialog1.FileName;


to change file name use below
C#
FileInfo file = new FileInfo("c:\test.txt");
file.Rename("test2.txt");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900