• webservice 文件流传入服务器


       [WebMethod(Description = "app考核评审附件上传    多个文件之间以'|'分隔     strDocCode取值:OState<4 strDocCode='MyP' else OState>=4  strDocCode='MyA' ", EnableSession = true)]
        public string appAuditUpfile(string strStaffNo, string strOID, string strDocCode, string strFileName, string strFile, string strFileSize, string strFileMemo)
        {
            var strJson = "";
            if (strFile.Length > 0)
            {
                string[] strTemp = strFile.Split('|');
                string[] strTempName = strFileName.Split('|');
                string[] strTempSize = strFileSize.Split('|');
                string[] strTempMemo = strFileMemo.Split('|');
                int strLength = strTemp.Length;
                if (strTemp.Length > 0)
                {
                    for (int i = 0; i < strTemp.Length; i++)
                    {
                        int seqno = int.Parse(GetAuditFileSeqno(strOID, strDocCode));
                        string strPath1 = "UpFile\Assess\";
                        var strExtent = strTempName[i].Substring(strTempName[i].LastIndexOf(".") + 1);
                        var strConvert = strOID + seqno + "." + strExtent;
                        string strPath = strTempName[i] + strConvert;
                        string strFilePath = Server.MapPath("UpFile\Assess\") + strPath;
                        string strDiskFolder = System.Web.HttpContext.Current.Server.MapPath(strPath1);
                        strPath = "../UpFile/Assess/" + strTempName[i] + strConvert;
                        if (!Directory.Exists(strDiskFolder))
                        {
                            Directory.CreateDirectory(strDiskFolder);
                        }
                        Base64Decoder decoder = new Base64Decoder();
                        Convert.FromBase64String(strTemp[i]);
                        byte[] buffer = decoder.GetDecoded(strTemp[i]);
                        FileStream fs = new FileStream(strFilePath, FileMode.Create);
                        BinaryWriter bw = new BinaryWriter(fs);
                        if (strTemp[i] != "" && System.IO.File.Exists(strFilePath))
                        {
                            bw.Write(Convert.FromBase64String(strTemp[i]));
                        }
                        bw.Close();
                        fs.Close();
                        SqlParameter[] pamFile = {
                                             new SqlParameter("@chrStaffNo",SqlDbType.Char,5,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strStaffNo),
                                             new  SqlParameter("@chrDocNo",SqlDbType.VarChar,50,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strOID),
                                             new  SqlParameter("@chrDocCode",SqlDbType.VarChar,3,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strDocCode),
                                             new  SqlParameter("@varFilePath",SqlDbType.VarChar,100,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strPath),
                                             new  SqlParameter("@varFileName",SqlDbType.VarChar,200,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strTempName[i]),
                                             new  SqlParameter("@intFileSize",SqlDbType.Int,4,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,Convert.ToInt32(strTempSize[i])),
                                             new  SqlParameter("@varFileMemo",SqlDbType.VarChar,500,ParameterDirection.Input,true,0,0,null,DataRowVersion.Current,strTempMemo[i])
                                         };
                        bool blnFlag = new AccessDB().ExecuteProcedure("frmAddUserFormClip", pamFile);
                        if (!blnFlag)
                        {
                            strJson = "{"respMessage"" + ":" + ""添加附件" + strTempName[i] + "时操作失败!"}";
                        }
                        else
                        {
                            strJson = "{"respMessage"" + ":" + ""保存成功"}";
                        }
                    }
                }
            }
            return strJson;
        }
  • 相关阅读:
    【整理】七大查找算法
    centos GUI界面与命令行的切换
    BogoMIPS与calibrate_delay
    Printk与sched_clock_init的一点分析
    系统启动 之 Linux系统启动概述(2)
    Linux Bootup Time
    系统启动 之 Linux系统启动概述(1)
    如何参与Linux内核开发(转)
    如何开始参与开源项目?
    非编程天才参与开源项目的14种方式(转)
  • 原文地址:https://www.cnblogs.com/ljj4490/p/7272306.html
Copyright © 2020-2023  润新知