How to get uploading file path

Posted by Naidulaxmi under ASP.NET on 10/26/2014 | Points: 10 | Views : 460 | Status : [Member] | Replies : 0
HI,


Upload file save to the "File" folder but not getting file path correctly.

code file is (.aspx) store in another folder like "test". execute bellow code come to the file path "D:\ReadExcelToGrid\ReadExcelToGrid\test\Files\Talent Tree Event Request Form.xlsx". the correct file pathe is "D:\ReadExcelToGrid\ReadExcelToGrid\Files\Talent Tree Event Request Form.xlsx"


string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);

string FolderPath = ConfigurationManager.AppSettings["FolderPath"];// FolderPath is key in app setting in web config<appSettings>
<add key="FolderPath" value="Files/"/>
</appSettings>

string FilePath = Server.MapPath(FolderPath + FileName);
FileUpload1.SaveAs(FilePath);


How to solve plese help me.


thanks,

appalanaidu


Responses

(No response found.)

Login to post response