Saturday, 24 August 2013

Finding the exact path of the file

Finding the exact path of the file

I am using the fileUpload control. When I upload the file, I want to find
the exact location of the file.
I tried using
string fname= Server.MapPath(FileUpload2.FileName);
string fname= FileUpload2.FileName;
string fname= FileUpload2.PostedFile.FileName;
2,#3 gave me the name of the file, #1 gave me the the path of my website
location.
I do not know what is the difference between 2 and 3, why both gave me
same results.
I read somewhere, that you cannot get the path. Is it true ? If not, what
code should I use ?

No comments:

Post a Comment