Q:

Get File Path using File name from a TextBox in C#

I'm using input type = file and I'm using Chrome so I would not be allowed to get the file path of the file chosen. It only gives back the file name.
This is my existing code:
string path = Path.GetFullPath(appPerfLog.Value);

I was expecting this result so that I could use the full Path in my app:
C:\Users\myUsername\Desktop\someFolder\Proactive_Hiring_VW101582_Combo_200users_09210316.csv

But this is what I get instead:
C:\Program Files (x86)\IIS Express\Proactive_Hiring_VW101582_Combo_200users_09210316.csv

How can I get the full path by searching the directories in my computer? I need to use it for StreamReader. Google Chrome only returns the file name due to security concerns so I need help on knowing a workaround/alternative.

A:

There is no such thing as a full path to an uploaded file, or at least, not one you ought to be using. 
When you upload a file to a web server, the web framework you use stores this file either in memory or on disk in a temporary directory, and from there, it is made accessible to your application as a stream to read it once, or with a method to save it to a directory of your choice.
What you're trying to do is not going to fly once your application is deployed on a web server, because there is no guarantee that the file is even going to be present with the name it used to have on the client. For all you know, the file named D:\Temp\Foo.txt at the client is named C:\Windows\Temp\asdfg123.tmp on the server. 
You will need to use the appropriate APIs for the web application framework you're using. For an ASP.NET FileUpload control, you're going to have to use FileUpload.SaveAs(string filename) to let ASP.NET write the file to a path of your choosing. After that, you can use the filename to read the file from your code.

