How to get file path using FileUpload to be read by FileStream?
- by john ryan
I have a Method that open excel file and read it through exceldatareaderClass that i have downloaded in codeplex by using filestream.
Currently I just declared the exact directory where the filestream open an excel file.And it works fine.
Stream stream = new FileStream("C:\\" + FileUpload.PostedFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
Now i need to read the excel file wherever location the user place it like on windows forms fileupload.FileStream needs the exact location where the file is located. How to do this.?
Example: Sample.xls is located on My Documents
the file path should be like : C:\Documents and Settings\user\My Documents\
string openpath ="" ;//filepath
Stream stream = new FileStream(openpath+ FileUpload.PostedFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
Thanks in Regards