| Author: lalitha 03 Dec 2008 | Member Level: Gold | Rating:  Points: 5 |
Hi
From where you are accessing the file ? If you are in a subfolder, server.Mappath will try to find the path including that folder that might be your problem
try like this
filepath = Path.GetFileName(FileUpload1.PostedFile.FileName); string dir = "subfolder/"; filename = Convert.ToString(Path.Combine(dir, filepath)); string file = Server.MapPath(filename); FileUpload1.PostedFile.SaveAs(Server.MapPath("~/folder2" + "/subfolder/" + FileUpload1.FileName));
Regards Lalitha
|
| Author: Programmer 03 Dec 2008 | Member Level: Diamond | Rating:  Points: 3 |
Dear friends, I have solved the problem.The problem was with the target folder but it showed problem with source file.The address of target folder was wrong.When it was corrected,the problem was solved.I have used the following code, strPath = txtFile.Value intPos = strPath.LastIndexOfAny("\") strFile = Mid$(strPath, intPos + 2, strPath.Length) txtFile.PostedFile.SaveAs(MapPath("~") & "Log\" & strFile)
Here txtFile is the name of the control.
|