首页 > 代码库 > 工作笔记——多文件上传
工作笔记——多文件上传
1 /// <summary> 2 /// 上传文件并显示出文件列表 3 /// </summary> 4 /// <param name="sender"></param> 5 /// <param name="e"></param> 6 protected void ImageButton2_Click(object sender, ImageClickEventArgs e) 7 { 8 // string FileNameStr = MYCLASS.PublicMethod.UploadFileIntoDir(this.FileUpload1, DateTime.Now.Ticks.ToString() + System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName)); 9 if (FileUpload1.FileName != "")10 {11 string FileNameStr = DateTime.Now.ToString("yyyymmddhhmmss") + FileUpload1.FileName;12 if (MYCLASS.PublicMethod.GetSessionValue("WenJianList").Trim() == "")13 {14 MYCLASS.PublicMethod.SetSessionValue("WenJianList", FileNameStr);15 }16 else17 {18 MYCLASS.PublicMethod.SetSessionValue("WenJianList", MYCLASS.PublicMethod.GetSessionValue("WenJianList") + "|" + FileNameStr);19 }20 if (FileUpload1.FileName != "")21 {22 FileUpload1.SaveAs(Server.MapPath("~/gongshi/" + FileNameStr));23 }24 MYCLASS.PublicMethod.BindDDL(this.CheckBoxList1, MYCLASS.PublicMethod.GetSessionValue("WenJianList"));25 // this.Label2.Text = MYCLASS.PublicMethod.GetWenJian(MYCLASS.PublicMethod.GetSessionValue("WenJianList"), "../gongshi/");26 }27 }28 /// <summary>29 /// 删除已选择的附件30 /// </summary>31 /// <param name="sender"></param>32 /// <param name="e"></param>33 protected void ImageButton3_Click(object sender, ImageClickEventArgs e)34 {35 try36 {37 for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)38 {39 if (this.CheckBoxList1.Items[i].Selected == true)40 {41 MYCLASS.PublicMethod.SetSessionValue("WenJianList", MYCLASS.PublicMethod.GetSessionValue("WenJianList").Replace(this.CheckBoxList1.Items[i].Value, "").Replace("||", "|"));42 }43 }44 MYCLASS.PublicMethod.BindDDL(this.CheckBoxList1, MYCLASS.PublicMethod.GetSessionValue("WenJianList"));45 }46 catch47 { }48 }
工作笔记——多文件上传
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。