How do I get the full path for a given file?
e.g. I provide:
string filename = @\"test.txt\";
Result should be:
Full Fi
try:
string fileName = @"test.txt";
string currentDirectory = Directory.GetCurrentDirectory();
string[] fullFilePath = Directory.GetFiles(currentDirectory, filename, SearchOption.AllDirectories);
it will return full path of all such files in the current directory and its sub directories to string array fullFilePath. If only one file exist it will be in "fullFileName[0]".
try..
Server.MapPath(FileUpload1.FileName);
You can get the current path:
string AssemblyPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString();
Good luck!