/// <summary> /// 上传附件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpload_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(UCProcessType)) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, "文档库设置不能为空!"); return; } if (multiFile.Files.Length <= 0) { return; } foreach (UploadedFile file in multiFile.Files) { if (file.FileName.Contains("#") || file.FileName.Contains("'")) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "含有特殊字符,请替换后再上传"); JScript.ResponseScript(this, "javascript:__doPostBack('LinkButton1','')"); return; } } foreach (UploadedFile file in multiFile.Files) { if (file.ContentLength <= MossObject.maxFileSize * 1024 * 1024) { MossObject attach = new MossObject(); attach.ServerWeb = OAConfig.GetConfig("MOSS认证", "ServerWeb"); attach.OldFileName = file.FileName; attach.DocumentName = UCProcessType; #region 更新栏位 List <DictionaryEntry> lst = new List <DictionaryEntry>(); DictionaryEntry de = new DictionaryEntry(); de.Key = "流程实例"; de.Value = UCProcessID; lst.Add(de); de = new DictionaryEntry(); de.Key = "别名"; de.Value = file.FileName; lst.Add(de); de = new DictionaryEntry(); de.Key = "上次修改者"; de.Value = CurrentUserInfo.DisplayName; lst.Add(de); #endregion DictionaryEntry[] result = attach.ConvertToDE(lst.ToArray()); attach.DocumentEntry = result; //文件扩展名 string fileType = System.IO.Path.GetExtension(file.FileName); if (fileType.IndexOf('.') == 0) { fileType = fileType.Substring(1); } bool IsSuccess = false; if ("exe,dll".Contains(fileType.ToLower())) { IMessage im = new WebFormMessage(Page, "不可上传exe或dll文件!"); im.Show(); IsSuccess = false; } else { attach.UploadFilesStream = file.InputStream; //上传附件并更新栏位 IsSuccess = attach.Upload(); } if (IsSuccess) { CFuJian ff = new CFuJian(); ff.Type = System.IO.Path.GetExtension(attach.FileName); if (ff.Type.IndexOf('.') == 0) { ff.Type = ff.Type.Substring(1); } ff.Title = attach.FileName; ff.Alias = System.IO.Path.GetFileNameWithoutExtension(attach.OldFileName); ff.FolderName = attach.FolderName; ff.FileName = attach.FileName; ff.Size = attach.ToFileSize_new(file.ContentLength); //文件大小 ff.ProcessType = UCProcessType; ff.WorkItemID = UCWorkItemID; ff.fullURL = attach.UploadFullName; //全路径 ff.URL = attach.UploadURL; //文件夹+/文件名 UCDataList.Add(ff); } //CFuJian l_objAttachment = MossObject.Upload(file, UCProcessType, UCProcessID, UCWorkItemID); //UCDataList.Add(l_objAttachment); } else { JScript.ShowMsgBox(Page, MsgType.VbExclamation, file.FileName + "大小超过" + MossObject.maxFileSize + "M"); } } RepeaterFiles.DataSource = UCDataList; RepeaterFiles.DataBind(); RunScript(); } catch (Exception ex) { JScript.ShowMsgBox(Page, MsgType.VbExclamation, ex.Message); } }
/// <summary> /// 步骤名称 /// </summary> public void SetButtonVisible() { JScript.ResponseScript(this.Page, "$('btnCirculateList').style.display='';$('linkCirculateList').style.display='none';", true); }