Пример #1
0
        private void ReportFile(HttpContext context)
        {
            string         _refilepath = ContextRequest.GetQueryString("ReFilePath"); //取得返回的对象名称
            string         _upfilepath = ContextRequest.GetQueryString("UpFilePath"); //取得上传的对象名称
            string         _delfile    = ContextRequest.GetString(_refilepath);
            HttpPostedFile _upfile     = context.Request.Files[_upfilepath];

            if (_upfile == null)
            {
                context.Response.Write("{\"msg\": 0, \"msgbox\": \"请选择要上传文件!\"}");
                return;
            }
            UpLoad upFiles = new UpLoad();
            string msg     = upFiles.ExcelFileSaveAs(_upfile, true);

            //删除已存在的旧文件
            Utils.DeleteUpFile(_delfile);
            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }