Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult InsertForm()
        {
            string             CID  = Request["StrCID"];
            HttpPostedFileBase file = Request.Files[0];

            byte[] fileByte = new byte[0];
            string FileName = file.FileName.Substring(file.FileName.LastIndexOf('\\') + 1);

            ViewData["FileName"] = FileName;


            int fileLength = file.ContentLength;

            if (fileLength != 0)
            {
                fileByte = new byte[fileLength];
                file.InputStream.Read(fileByte, 0, fileLength);
            }
            string strErr = "";

            if (ContractMan.InsertNewFile(CID, fileByte, FileName, ref strErr) == true)
            {
                ViewData["msg"]    = "上传成功";
                ViewData["StrCID"] = CID;
                return(View("AddFile"));
            }
            else
            {
                ViewData["msg"] = "上传失败";
                return(View("AddFile"));
            }
        }