您的位置:首页 > 其它

判断是否有文件存在

2005-05-02 21:36 393 查看
 using System.IO;
if(File.Exists(Server.MapPath(路径)))//返回BOOL值
{

}
//下面是怡然居网站中的代码xsfyxx.aspx184行
string strpicsw="uploadpic/"+lbno.Text+"a.jpg";
string strpichx="uploadpic/"+lbno.Text+"a.jpg";
if(File.Exists(Server.MapPath(strpicsw))!=false || File.Exists(Server.MapPath(strpichx))!=false)
     {
       if(File.Exists(Server.MapPath(strpicsw)))
       {
        Label1.Text="<a href='uploadpic/"+lbno.Text+"a.jpg' target='_blank'>查看实物图</a>";
       } 
       
       if(File.Exists(Server.MapPath(strpichx)))
       {
        Label2.Text="<a href='uploadpic/"+lbno.Text+"b.jpg' target='_blank'>查看户型图</a>";
       } 
       
     }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string