troubleshooting Question

File Upload & Read Problem - Could not find a part of the path

Avatar of Hojoformo
Hojoformo asked on
C#
4 Comments1 Solution2022 ViewsLast Modified:
This should be a problem bug to find.  I keep getting error message "Could not find a part of the path "C:\Inetpub\wwwroot\WebApplication7\055070021FEB-04DET.csv" when trying to read records.   This is not the path I saved the file to on the server.  

string sFileDir= "c:/hosting/webhost4life/member/vcn770/ASPX/";
string sFileName = System.IO.Path.GetFileName(filUpload.PostedFile.FileName);
                        
filUpload.PostedFile.SaveAs(sFileDir + sFileName);
                        
StreamReader reader = new StreamReader(filUpload.PostedFile.FileName);  ???? is there something wrong with this code?????  
readcontents = reader.ReadLine();
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros