コード例 #1
0
ファイル: UeditorController.cs プロジェクト: gofixiao/dlerp
        public ActionResult imageup()
        {
            //上传配置
            int size = 2;           //文件大小限制,单位MB                             //文件大小限制,单位MB
            string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" };         //文件允许格式

            //上传图片
            Hashtable info = new Hashtable();
            UeditUploader up = new UeditUploader();

            string pathbase = null;
            int path = Convert.ToInt32(up.getOtherInfo("dir"));
            if (path == 1)
            {
                pathbase = "~/Content/ueditor/image/";

            }
            else
            {
                pathbase = "~/Content/ueditor/image/";
            }

            info = up.upFile(pathbase, filetype, size);                   //获取上传状态

            string title = up.getOtherInfo("pictitle");                   //获取图片描述
            string oriName = up.getOtherInfo("fileName");                //获取原始文件名

            string url = info["url"].ToString();
            url = url.Substring(23);
            return Content("{'url':'" + url + "','title':'" + title + "','original':'" + oriName + "','state':'" + info["state"] + "'}");  //向浏览器返回数据json数据
        }
コード例 #2
0
        public ActionResult imageup()
        {                                                                    //上传配置
            int size = 2;                                                    //文件大小限制,单位MB                             //文件大小限制,单位MB

            string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式


            //上传图片
            Hashtable     info = new Hashtable();
            UeditUploader up   = new UeditUploader();

            string pathbase = null;
            int    path     = Convert.ToInt32(up.getOtherInfo("dir"));

            if (path == 1)
            {
                pathbase = "~/Content/ueditor/image/";
            }
            else
            {
                pathbase = "~/Content/ueditor/image/";
            }

            info = up.upFile(pathbase, filetype, size);                  //获取上传状态

            string title   = up.getOtherInfo("pictitle");                //获取图片描述
            string oriName = up.getOtherInfo("fileName");                //获取原始文件名

            string url = info["url"].ToString();

            url = url.Substring(23);
            return(Content("{'url':'" + url + "','title':'" + title + "','original':'" + oriName + "','state':'" + info["state"] + "'}"));  //向浏览器返回数据json数据
        }
コード例 #3
0
ファイル: UeditorController.cs プロジェクト: gofixiao/dlerp
        public ActionResult fileup()
        {
            //上传配置
            String pathbase = "~/Content/ueditor/file/";                                      //保存路径
            string[] filetype = { ".rar", ".doc", ".docx", ".zip", ".pdf", ".txt", ".swf", ".wmv" };    //文件允许格式
            int size = 100;   //文件大小限制,单位MB,同时在web.config里配置环境默认为100MB

            //上传文件
            Hashtable info = new Hashtable();

            UeditUploader up = new UeditUploader();
            info = up.upFile(pathbase, filetype, size); //获取上传状态

            return Content("{'state':'" + info["state"] + "','url':'" + info["url"] + "','fileType':'" + info["currentType"] + "','original':'" + info["originalName"] + "'}"); //向浏览器返回数据json数据
        }
コード例 #4
0
        public ActionResult fileup()
        {
            //上传配置
            String pathbase = "~/Content/ueditor/file/";                                             //保存路径

            string[] filetype = { ".rar", ".doc", ".docx", ".zip", ".pdf", ".txt", ".swf", ".wmv" }; //文件允许格式
            int      size     = 100;                                                                 //文件大小限制,单位MB,同时在web.config里配置环境默认为100MB


            //上传文件
            Hashtable info = new Hashtable();

            UeditUploader up = new UeditUploader();

            info = up.upFile(pathbase, filetype, size);                                                                                                                          //获取上传状态

            return(Content("{'state':'" + info["state"] + "','url':'" + info["url"] + "','fileType':'" + info["currentType"] + "','original':'" + info["originalName"] + "'}")); //向浏览器返回数据json数据
        }