隨筆 - 30, 文章 - 0, 評論 - 9, 引用 - 0
          數(shù)據(jù)加載中……

          文件上傳

          ?function OutputUpload(id,title) { var tblMain=document.getElementById("Table2"); var tbl=document.getElementById("Table3"); var isExsitfile=document.getElementById("file"+id); var text=document.createTextNode("上傳:"+title+"虛擬形象圖片"); if(isExsitfile==null) { var str= ""; tbl.rows[id].cells[0].insertAdjacentHTML("beforeEnd",str) ; tbl.rows[id].cells[0].appendChild(text); } else { tbl.rows[id].cells[0].removeChild(isExsitfile); tbl.rows[id].cells[0].innerText=""; } }

          if(Request.Form["CHK"]!=null)
          ???{?? string chkvalue=Request.Form["CHK"].ToString();
          ????string[] mylayer=chkvalue.Split(new char[]{','});
          ????string layer="";
          ????for(int i=0;i<mylayer.Length;i++)
          ????{?????
          ?????
          ?????if(layer!="")
          ?????{
          ??????layer+="_";
          ?????}
          ?????layer+=mylayer[i];
          ?????
          ????}
          ????ViewState["layer"]=layer;
          ??????
          ????//得到數(shù)據(jù)庫編號
          ????if(itemid1.ToString()==null)
          ????{
          ?????itemid1=itemid1+1;
          ????}
          ????else
          ????{
          ?????itemid1=GetItemID()+1;
          ????}
          ????System.Web.HttpFileCollection files=System.Web.HttpContext.Current.Request.Files;
          ????try
          ????{
          ?????for(int i=0;i<files.Count;i++)
          ?????{??
          ??????string fid=itemid1+".gif";
          ??????HttpPostedFile postedFile=files[i];
          ??????
          ??????if(postedFile.FileName.Length>0)
          ??????{
          ???????string fileName,fileExtension;
          ???????fileName=System.IO.Path.GetFileName(postedFile.FileName);
          ???????fileExtension=System.IO.Path.GetExtension(fileName);

          ???????if(fileExtension!=GlobalVars.FILETAILNAME[0])
          ???????{
          ????????Response.Write("<script>alert(\"文件格式不正確?。。")</script>");
          ????????return;
          ???????}
          ???????if(i==0)
          ???????{
          ????????//上傳圖片到服務器上??
          ????????BLL.Visual_Items bll=new BLL.Visual_Items();
          ????????bool tf=bll.Exists(this.txtName.Text);
          ????????if(tf==false)
          ????????{??
          ?????????if(System.IO.Directory.Exists(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\0"))
          ?????????{
          ??????????postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\0\\" + fid);?
          ?????????}
          ?????????else
          ?????????{
          ??????????System.IO.Directory.CreateDirectory(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\0");
          ??????????postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\0\\" + fid);?
          ?????????}
          ?????????// 把圖片的信息記錄保留到數(shù)據(jù)庫中
          ?????????string s="images/img_Visual/show/0/"+fid;
          ?????????AddData(s,itemid1,layer);

          ????????}
          ????????else
          ????????{
          ?????????this.Response.Write("<script>alert('數(shù)據(jù)庫已存在此條數(shù)據(jù)!')</script>");
          ????????}

          ???????}
          ???????else
          ???????{
          ????????if(System.IO.Directory.Exists(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\"+mylayer[i-1]))
          ????????{
          ?????????postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\"+mylayer[i-1]+"\\" + fid);
          ????????}
          ????????else
          ????????{
          ?????????System.IO.Directory.CreateDirectory(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\"+mylayer[i-1]);
          ?????????postedFile.SaveAs(Server.MapPath(Request.ApplicationPath) + "\\images\\img_Visual\\show\\"+mylayer[i-1]+"\\" + fid);

          ????????}
          ???????}
          ??????}
          ??????else
          ??????{
          ???????Response.Write("<script>alert(\"虛擬形象圖片不能為空!\")</script>");
          ???????return ;

          ??????}
          ?????}?
          ????}
          ????catch(Exception ex)
          ????{
          ?????string sRawURL = Request.RawUrl;

          ?????if(sRawURL.IndexOf("?") > -1)
          ?????{
          ??????sRawURL = sRawURL.Substring(0,sRawURL.IndexOf("?"));
          ?????}????
          ?????
          ?????Response.Write(ex.ToString());
          ????}?
          ???}
          ???else
          ???{
          ?????????????? Response.Write("<script>alert(\"請選擇虛擬形象所屬層!!\")</script>");
          ???}

          posted on 2006-12-16 11:31 風雨兼程 閱讀(244) 評論(0)  編輯  收藏 所屬分類: Asp.net

          主站蜘蛛池模板: 汕头市| 芜湖市| 临汾市| 抚远县| 鄂尔多斯市| 灯塔市| 临泉县| 孝昌县| 佛冈县| 宁远县| 营山县| 永春县| 禹城市| 湖南省| 佛学| 泾源县| 随州市| 通河县| 平南县| 龙游县| 红河县| 诸暨市| 嘉定区| 秭归县| 华池县| 咸宁市| 牟定县| 锦州市| 中阳县| 闽清县| 嘉鱼县| 昌宁县| 永宁县| 赤城县| 朝阳县| 左权县| 太仆寺旗| 江华| 毕节市| 莱西市| 萝北县|