string bookNo = "01";
            bookNo = Request.Params["no"] == null ? "01" : Request.Params["no"];
            DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/" + bookNo));
            if(!dir.Exists){
                dir = new DirectoryInfo(Server.MapPath("~/_img/bookImg/01"));
                bookNo = "01";
            }
            FileInfo[] files = dir.GetFiles();
            StringBuilder sb = new StringBuilder();
            foreach (FileInfo file in files)
            {
                sb.Append("<img src='' data-original='_img/bookImg/" + bookNo + "/" + file.Name + "' style='width:100%;'  />");
            }
            bookImg.InnerHtml = sb.ToString();

文章標籤
全站熱搜
創作者介紹
創作者 amychang2014 的頭像
amychang2014

工作需要筆記

amychang2014 發表在 痞客邦 留言(0) 人氣(576)