コード例 #1
0
        /// <summary>
        /// 文件上传
        /// </summary>
        /// <param name="context">HttpContext</param>
        /// <returns></returns>
        public String FileUpLoad(HttpContext context)
        {
            var config = UEditorConfig.Current;
            var up     = new UEUploader();
            var info   = up.upFile(context, config.UploadPath, config.FileExtensions, config.FileFileSize);                             //获取上传状态

            return("{'state':'" + info["state"] + "','url':'" + info["url"] + "','fileType':'" + info["currentType"] + "','original':'" + info["originalName"] + "'}");
        }
コード例 #2
0
        /// <summary>
        /// 图片上传
        /// </summary>
        /// <param name="context">HttpContext</param>
        /// <returns></returns>
        public String ImgUp(HttpContext context)
        {
            var config  = UEditorConfig.Current;
            var up      = new UEUploader();
            var info    = up.upFile(context, config.UploadPath, config.ImgExtensions, config.ImgFileSize); //获取上传状态
            var title   = up.getOtherInfo(context, "pictitle");                                            //获取图片描述
            var oriName = up.getOtherInfo(context, "fileName");                                            //获取原始文件名

            return("{'url':'" + info["url"] + "','title':'" + title + "','original':'" + oriName + "','state':'" + info["state"] + "'}");
        }
コード例 #3
0
        /// <summary>
        /// 涂鸦处理
        /// </summary>
        /// <param name="context">HttpContext</param>
        /// <returns></returns>
        public String ScrawlUp(HttpContext context)
        {
            var Entity = UEditorConfig.Current;
            var info   = new Hashtable();
            var up     = new UEUploader();
            var action = RequestStr("action");

            if (action == "tmpImg")
            {
                var pathbase = Entity.UploadPath + "tmp/";                                     //保存路径
                info = up.upFile(context, pathbase, Entity.ImgExtensions, Entity.ImgFileSize); //获取上传状态
                return("<script>parent.ue_callback('" + "tmp/" + info["url"] + "','" + info["state"] + "')</script>");
            }
            else
            {
                var tmpPath = Entity.UploadPath + "tmp/";
                info = up.upScrawl(context, Entity.UploadPath, tmpPath, RequestStr("content")); //获取上传状态
                return("{'url':'" + info["url"] + "',state:'" + info["state"] + "'}");
            }
        }