Example #1
0
        public ActionResult UploadResourceFiles()
        {
            try
            {
                if (HttpContext.Request["resourceId"] != null)
                {
                    string resourceId = HttpContext.Request["resourceId"];

                    ResourceApp resourceApp = new ResourceApp();

                    ResourceEntity resourceEntity = resourceApp.GetForm(Base_WebSiteId, resourceId);
                    if (resourceEntity != null)
                    {
                        UpFileDTO entity = new UpFileDTO();
                        if (HttpContext.Request.Files.Count > 0)
                        {
                            var upFiles = HttpContext.Request.Files;
                            for (int i = 0; i < upFiles.Count; i++)
                            {
                                if (new WebSiteApp().IsOverSizeByWebSiteId(Base_WebSiteId, upFiles[i].ContentLength))
                                {
                                    throw new Exception("该站点空间已不足,请联系管理员!");
                                }
                                CMS.Application.SystemManage.UpFileApp upfileApp = new Application.SystemManage.UpFileApp();
                                string savePaths = HTMLCONTENTSRC + resourceEntity.UrlAddress + @"\\";
                                upfileApp.UpLoadFile(upFiles[i], savePaths, true, false);
                            }
                        }
                        else
                        {
                            return(Success("true"));
                        }
                    }
                    return(Success("true"));
                }
                else
                {
                    return(Success("false", "未选择资源文件夹!"));
                }
            }
            catch (Exception ex)
            {
                return(Success("false", ex.Message));
            }
        }
Example #2
0
        public ActionResult GetFormJson(string keyValue)
        {
            var data = resourceApp.GetForm(Base_WebSiteId, keyValue);

            return(Content(data.ToJson()));
        }