Esempio n. 1
0
        private void MultipleFile(HttpContext context)
        {
            string         _upfilepath  = context.Request.QueryString["UpFilePath"]; //取得上传的对象名称
            HttpPostedFile _upfile      = context.Request.Files[_upfilepath];
            bool           _iswater     = false;                                     //默认不打水印
            bool           _isthumbnail = false;                                     //默认不生成缩略图

            if (ContextRequest.GetQueryString("IsWater") == "1")
            {
                _iswater = true;
            }
            if (ContextRequest.GetQueryString("IsThumbnail") == "1")
            {
                _isthumbnail = true;
            }

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

            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            //取得处事类型
            string action = ContextRequest.GetQueryString("action");

            switch (action)
            {
            case "SingleFile":     //单文件
                SingleFile(context);
                break;

            case "MultipleFile":     //多文件
                MultipleFile(context);
                break;

            case "AttachFile":     //附件
                AttachFile(context);
                break;

            case "EditorFile":     //编辑器文件
                EditorFile(context);
                break;

            case "ManagerFile":     //管理文件
                ManagerFile(context);
                break;
            }
        }
        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();
        }
Esempio n. 4
0
        private void SingleFile(HttpContext context)
        {
            string         _refilepath  = ContextRequest.GetQueryString("ReFilePath"); //取得返回的对象名称
            string         _upfilepath  = ContextRequest.GetQueryString("UpFilePath"); //取得上传的对象名称
            string         _delfile     = ContextRequest.GetString(_refilepath);
            HttpPostedFile _upfile      = context.Request.Files[_upfilepath];
            bool           _iswater     = false; //默认不打水印
            bool           _isthumbnail = false; //默认不生成缩略图
            bool           _isimage     = false;

            if (ContextRequest.GetQueryString("IsWater") == "1")
            {
                _iswater = true;
            }
            if (ContextRequest.GetQueryString("IsThumbnail") == "1")
            {
                _isthumbnail = true;
            }
            if (ContextRequest.GetQueryString("IsImage") == "1")
            {
                _isimage = true;
            }

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

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