cs代码:
- #region///上传,文件名称添加数据库,文件保存相应路径 /// <summary>
- /// 添加附件 /// </summary>
- /// <param name="sender"></param> /// <param name="e"></param>
- protected void btnImport_Click(object sender, EventArgs e) {
- string res = "0"; string fileName = UpLoadTxt.FileName;//获取要导入的文件名
- if (fileName == null || fileName == "") {
- res = "2"; }
- else {
- string savePath = Server.MapPath("~/UploadFiles/ChatLog/"); FileOperatpr(fileName, savePath);
- string url = savePath + fileName; UpLoadTxt.SaveAs(url);
- SqlConnection conn = SqlHelperEx.ConnOpen("SPSDB"); string ExtName = getFileExt(fileName).ToUpper();//获取上传文件名称
- // string ENDNmae = getFileEND(fileName).ToUpper(); //后缀名 id = Request["id"];
- res = GetAccessory(conn, fileName, id); SqlHelperEx.ConnClose(conn);
- } if (res == "2")
- { Response.Write("<script>alert('没有要添加的文件,请选中文件后再操作!');window.location.href='SNSNeedingOrder_InfoListView.aspx?id=" + Request["id"] + "';</script>");
- } if (res == "0")
- { Response.Write("<script>alert('添加失败!');window.location.href='SNSNeedingOrder_InfoListView.aspx?id=" + Request["id"] + "';</script>");
- } if(res=="1") {
- Response.Write("<script>alert('添加成功!');window.location.href='SNSNeedingOrder_InfoListView.aspx?id=" + Request["id"] + "';</script>"); }
- if (res == "3") {
- Response.Write("<script>alert('没有需求单,非法操作!');window.location.href='SNSNeedingOrder_InfoListView.aspx?id=" + Request["id"] + "';</script>"); }










