Tuesday, July 1, 2014

Code to Check for file exist or not and If exist then delete and save

if (!Directory.Exists(Server.MapPath(@"ProjectPoster\\ProjectFile\\")))
{
Directory.CreateDirectory(Server.MapPath(@"ProjectPoster\\ProjectFile\\"));
}
fileExist = "~/ProjectPoster/ProjectFile/" + strFileName;
if (File.Exists(Server.MapPath(fileExist)))
{
File.Delete(Server.MapPath(fileExist));
}



Enjoy the day with Lots of smile and Happiness.....

No comments:

Post a Comment