I am using fileupload control to get the path of the file..
But it gives me some “C:” path instead of the real path of the file..
how can i get the real path of the file uploaded.
I am using :
Path.GetFullPath(FileUpload1.FileName)
to get the file path..
but i am getting the path as:
"C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\+filename"
This is not possible as it would be a security risk.
It is not clear to me what path you are getting, as you should only be getting a file name – you should supply the path to where to save the file.
Edit:
You are getting the full path to the file – this shouldn’t be happening and doesn’t when using most browsers. However, IE does give the full path, even though it is a security hole.
Edit 2:
You are using
Path.GetFullPathand are supplying the filename only. When this happens, the current directory path is perpended to the filename. This would be the directory that your code is running from by default.From MSDN: