Tuesday, 25 October 2016

How to get the full file path from asp:FileUpload?

How can i get Selected file path in asp.net?

Description:

In this example we explain that how select folder path in asp.net using C# or how to get path of selected file in asp.net.how to browse file and get file path in asp.net.or how to get the full file path from asp: FileUplaod control. Or how can I get selected file path in asp.net.or how to get physical path or selected filed local path or drive path in asp.net.there are many question are raised for different user because we easily find the server path but to get the physical or local path its difficult because it will return fake path in JavaScript.


Below is the code that will returns the selected file full path like if I select file from D:\user doc new 2011\Montana\MT_SUTA_2010-2011.html  then it will returns same path like D:\user doc new 2011\Montana\MT_SUTA_2010-2011.html.

Code:

string file = System.IO.Path.GetFullPath(FileUpload1.PostedFile.FileName);


0 comments:

Post a Comment