ASP.NET 判断文件是否存在

//服务器的绝对路径   
string path1 = Server.MapPath("").Substring(0, (Server.MapPath("").IndexOf("\\Manage\\")));
//文件路径 upload是一个文件夹
string path2 = string.Format(@"/{0}/20{1}/{2}/{3}/{4}.wav", "upload", callid.Substring(1, 2), callid.Substring(3, 2), callid.Substring(5, 2), callid); if (System.IO.File.Exists(path1 + path2)) { //表示存在 }

 

posted @ 2014-06-13 14:41  JasonGu0  阅读(731)  评论(0)    收藏  举报