示例#1
0
 protected DataSet GetDataList()
 {
     if (AppCache.IsExist("SysMenuList"))
     {
         ds = (DataSet)AppCache.Get("SysMenuList");
     }
     else
     {
         ds = bll.GetList("");
         AppCache.AddCache("SysMenuList", ds);
     }
     return(ds);
 }
示例#2
0
 /// <summary>
 /// 缓存前台栏目
 /// </summary>
 /// <param name="nodeCode"></param>
 /// <returns></returns>
 public DataTable SiteMenu_GetNodeFromCache(int siteid)
 {
     if (KingTop.Common.AppCache.IsExist("SiteMenuNodeCache"))
     {
         return((DataTable)KingTop.Common.AppCache.Get("SiteMenuNodeCache"));
     }
     else
     {
         DataTable dt = GetList("LISTBYSITE", Utils.getOneParams(siteid.ToString()));
         AppCache.AddCache("SiteMenuNodeCache", dt, 60);
         return(dt);
     }
 }
示例#3
0
        //从缓存中获取K_SysModuleNode表

        public DataTable GetModeNodeFromCache()
        {
            if (AppCache.IsExist("ModeNodeAndModuleCache"))
            {
                return((DataTable)AppCache.Get("ModeNodeAndModuleCache"));
            }
            else
            {
                DataTable dt = GetList("Cache", Utils.getOneParams(""));
                AppCache.AddCache("ModeNodeAndModuleCache", dt, 1440);
                return(dt);
            }
        }
示例#4
0
 /// <summary>
 /// 从缓存读取栏目信息,如果缓存没有相关信息,则从数据库读取,然后添加到缓存
 /// </summary>
 /// <param name="nodeCode"></param>
 /// <returns></returns>
 public DataTable Publish_GetNodeFromCache()
 {
     if (KingTop.Common.AppCache.IsExist("PublishNodeCache"))
     {
         return((DataTable)KingTop.Common.AppCache.Get("PublishNodeCache"));
     }
     else
     {
         DataTable dt = GetList("GETNODEID", Utils.getOneParams(""));
         AppCache.AddCache("PublishNodeCache", dt, 60);
         return(dt);
     }
 }
示例#5
0
 //操作缓存
 public DataTable GetModuleActionFromCache()
 {
     if (AppCache.IsExist("ModuleActionCache"))
     {
         return((DataTable)AppCache.Get("ModuleActionCache"));
     }
     else
     {
         DataTable dt = GetList("ACTIONAll", Utils.getOneParams(""));
         AppCache.AddCache("ModuleActionCache", dt, 1440);
         return(dt);
     }
 }
示例#6
0
 //用户组角色
 public DataTable GetUserGroupRoleFromCache()
 {
     if (AppCache.IsExist("UserGroupRoleCache"))
     {
         return((DataTable)AppCache.Get("UserGroupRoleCache"));
     }
     else
     {
         DataTable dt = GetList("GROUPROLEAll", Utils.getOneParams(""));
         AppCache.AddCache("UserGroupRoleCache", dt, 1440);
         return(dt);
     }
 }
示例#7
0
 public DataTable GetAccountPermitFromCache()
 {
     if (AppCache.IsExist("AccountPermitCache"))
     {
         return((DataTable)AppCache.Get("AccountPermitCache"));
     }
     else
     {
         DataTable dt = GetList("USERPERMITAll", Utils.getOneParams(""));
         AppCache.AddCache("AccountPermitCache", dt, 1440);
         return(dt);
     }
 }
示例#8
0
    /// <summary>
    /// 获取菜单个
    /// </summary>
    /// <returns></returns>
    public DataTable GetSysmenu()
    {
        DataTable dt = new DataTable();

        try
        {
            if (AppCache.IsExist("SysmenuList"))
            {
                dt = (DataTable)AppCache.Get("SysmenuList");
            }
            else
            {
                dt = bll.GetList("sysmenutab", " scode,surl ", "scode", 1000, 1, 0, 0, "");
                AppCache.AddCache("SysmenuList", dt, 1);
            }
        }
        catch
        {
            dt = null;
        }
        return(dt);
    }
示例#9
0
    /// <summary>
    /// 获取权限表
    /// </summary>
    /// <returns></returns>
    public DataTable GetSyspermission()
    {
        DataTable dt = new DataTable();

        try
        {
            if (AppCache.IsExist("SyspermissionList"))
            {
                dt = (DataTable)AppCache.Get("SyspermissionList");
            }
            else
            {
                dt = bll.GetList("syspermissiontab", " roleid,spcode ", "roleid", 1000, 1, 0, 0, "");
                AppCache.AddCache("SyspermissionList", dt, 1);
            }
        }
        catch
        {
            dt = null;
        }
        return(dt);
    }
示例#10
0
    /// <summary>
    /// 获取用户组,采用缓存cache
    /// </summary>
    /// <returns></returns>
    public DataTable GetSystem()
    {
        DataTable dt = new DataTable();

        try
        {
            if (AppCache.IsExist("SystemList"))
            {
                dt = (DataTable)AppCache.Get("SystemList");
            }
            else
            {
                dt = bll.GetList("system", "employeeid,tem", "employeeid", 1000, 1, 0, 0, "");
                AppCache.AddCache("SystemList", dt, 1);
            }
        }
        catch
        {
            dt = null;
        }
        return(dt);
    }
示例#11
0
        public string GetManageDir()
        {
            string re = "";

            if (AppCache.IsExist("CacheManageDir"))
            {
                re = KingTop.Common.AppCache.Get("CacheManageDir").ToString();
            }
            else
            {
                string siteParamPath = Server.MapPath("/sysadmin/Configuraion/SiteInfoManage.config");
                re = Utils.XmlRead(siteParamPath, "/SiteInfoManage/ManageDir", "").ToLower();
                AppCache.AddCache("CacheManageDir", re, 144000);
            }

            if (re != "")
            {
                re = "../" + re + "/";
            }

            return(re);
        }
示例#12
0
    /// <summary>
    /// 获取所有菜单,采用缓存cache
    /// </summary>
    /// <returns></returns>
    public DataTable GetMenuCompetence()
    {
        DataTable dt = new DataTable();
        try
        {
            if (AppCache.IsExist("MemberMenu"))
            {
                dt = (DataTable)AppCache.Get("MemberMenu");
            }
            else
            {
                dt = dal.GetList("*", "MenuTab", "where MCheck=1 and  MCode like 'M%'  order by Sort ");
                AppCache.AddCache("MemberMenu", dt, 24)
;
            }
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
示例#13
0
    /// <summary>
    /// 取出所有权限,放入cache
    /// </summary>
    /// <returns></returns>
    public DataTable GetMemberCompetenceAll()
    {
        DataTable dt = new DataTable();
        try
        {

            if (AppCache.IsExist("MemberCompetenceAll"))
                {
                    dt = (DataTable)AppCache.Get("MemberCompetenceAll");
                }
                else
                {
                    dt = dal.GetList("PCode,ManageTypeID,MemberGradeID", "SystemPermissionTab", "");
                    AppCache.AddCache("MemberCompetenceAll", dt, 24);
                }
        }
        catch
        {
            dt = null;
        }
        return dt;
    }
    private void On_Upload(HttpPostedFile file)
    {
        if (file != null && file.ContentLength > 0)
        {
            #region 变量

            strParam    = Request.QueryString["InitParam"];
            initArr     = Utils.strSplit(strParam, "_tp_");
            SiteDir     = GetUrlParam("SiteDir", initArr);
            SaveFileKey = GetUrlParam("CacheKey", initArr);

            string   ImgSet    = GetUrlParam("ImgSet", initArr);
            string[] arrImgSet = ImgSet.Split(',');
            thumbWidth  = Utils.ParseInt(arrImgSet[0], 0);
            thumbHeight = Utils.ParseInt(arrImgSet[1], 0);
            IsWater     = Utils.ParseInt(arrImgSet[2], 0);
            string UPType = GetUrlParam("UpType", initArr);
            if (string.IsNullOrEmpty(UPType))
            {
                UPType = "image";
            }

            string saveType = GetUrlParam("SaveType", initArr);         // 保存文件名类型,1=用上传文件名保存,否则用系统时间重命名保存

            string noExt = SystemConst.NOT_ALLOWED_UPLOAD_TYPE;         // 不允许上传类型

            string fileName = string.Empty;                             // 文件名

            string saveName = DateTime.Now.ToString("yyyyMMddHHmmss");  // 上传文件名

            string fileExt = string.Empty;                              // 上传文件扩展名

            fileName = Path.GetFileName(file.FileName);
            fileExt  = Path.GetExtension(fileName).ToLower(); //上传文件扩展名
            #endregion
            if (noExt.IndexOf(fileExt) != -1)
            {
                System.Web.HttpContext.Current.Response.Write("改文件类型不允许上传!");
                System.Web.HttpContext.Current.Response.End();
            }

            SavePath = string.IsNullOrEmpty(SiteDir) == true ? uploadobj.ImageSavePath + "/" + UPType + "s" : uploadobj.ImageSavePath + "/" + SiteDir + "/" + UPType + "s";
            URL      = GetUploadUrl(uploadobj.ImageUrl, UPType + "s", SavePath);
            string reFilePath = URL;         // 返回文件路径,如果保存路径填写的是
            if (SavePath.IndexOf(":") == -1) //判断输入的是虚拟路径
            {
                SavePath = Server.MapPath(GetVirtualPath + SavePath);
            }



            SavePath = SavePath + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/";
            if (!Directory.Exists(SavePath))
            {
                Directory.CreateDirectory(SavePath);
            }

            if (saveType == "1")  //使用原文件名进行保存到服务器
            {
                int fileNameLength = fileName.LastIndexOf(".");
                saveName = fileName.Substring(0, fileNameLength);
            }

            fileName = SavePath + saveName + fileExt;
            URL      = DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + saveName + fileExt;
            if (File.Exists(fileName) && saveType == "1")
            {
                File.Delete(fileName);
            }

            try
            {
                file.SaveAs(fileName);                 //保存至服务器

                if (thumbWidth > 0 || thumbHeight > 0) //判断是否上传的是否需生成缩略图
                {
                    string thumbMode = "HW";
                    if (thumbWidth > 0 && thumbHeight == 0)
                    {
                        thumbMode = "W";
                    }
                    else if (thumbWidth == 0 && thumbHeight > 0)
                    {
                        thumbMode = "H";
                    }
                    KingTop.WEB.SysAdmin.UploadBase.MakeThumbnail(fileName, fileName + ".gif", thumbWidth, thumbHeight, thumbMode);     // 生成缩略图方法
                }

                if (IsWater == 1)  //如果上传图片,则判断是否需要打水印
                {
                    KingTop.WEB.SysAdmin.UploadBase.ImageWater(uploadobj, fileName);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }

            //缓存返回值
            string returnStr;
            if (AppCache.IsExist(SaveFileKey))
            {
                returnStr = AppCache.Get(SaveFileKey) + "," + URL;
                AppCache.Remove(SaveFileKey);
            }
            else
            {
                returnStr = URL;
            }

            AppCache.AddCache(SaveFileKey, returnStr, 1200);
        }
    }
示例#15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsHaveRightByOperCode("Edit"))
            {
                string siteLoginXml = Server.MapPath("/sysadmin/Configuraion/SiteInfoManage.config");
                if (isMainDomain)
                {
                    if (this.RadTrue.Checked)
                    {
                        if (this.txtManageCode.Text.Trim() == "")
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点参数设置失败,后台管理认证码必须填写!',title:'提示信息'})");
                            return;
                        }
                        if (!Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/IsEnableManageCode", "", "1"))
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点参数设置失败,配置文件“" + siteLoginXml + "”位置不对或者没有修改权限!',title:'提示信息'})");
                            return;
                        }
                        Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/ManageCode", "", this.txtManageCode.Text);
                    }
                    else
                    {
                        Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/IsEnableManageCode", "", "0");
                    }
                    Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/ManageDir", "", this.txtManageDir.Text);
                    AppCache.Remove("CacheManageDir");
                    AppCache.AddCache("CacheManageDir", this.txtManageDir.Text, 144000);
                }
                string thisDwManage = Server.HtmlEncode(txtSiteDWMange.Text.Trim());
                if (string.IsNullOrEmpty(thisDwManage))
                {
                    thisDwManage = "360hqb";
                }
                thisDwManage = thisDwManage.Replace(",", "");

                //修改DW校验码
                string siteDwManage     = Utils.XmlRead(siteLoginXml, "SiteInfoManage/SiteDWMange", "");
                string siteDwManageList = string.Empty;
                bool   isEditDwManage   = false;
                if (!string.IsNullOrEmpty(siteDwManage))
                {
                    string[] arr1 = siteDwManage.Split('|');
                    for (int i = 0; i < arr1.Length; i++)
                    {
                        string[] arr2 = arr1[i].Split(',');
                        if (SiteID == Utils.ParseInt(arr2[0], 0))
                        {
                            string tmpDwManage = arr2[0] + "," + arr2[1] + "," + thisDwManage;

                            if (string.IsNullOrEmpty(siteDwManageList))
                            {
                                siteDwManageList = tmpDwManage;
                            }
                            else
                            {
                                siteDwManageList += "|" + tmpDwManage;
                            }
                            isEditDwManage = true;
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(siteDwManageList))
                            {
                                siteDwManageList = arr1[i];
                            }
                            else
                            {
                                siteDwManageList += "|" + arr1[i];
                            }
                        }
                    }
                }

                if (string.IsNullOrEmpty(siteDwManage) || isEditDwManage == false)
                {
                    string siteInfoXml = Server.MapPath("/" + SiteDir + "/config/SiteInfo.config");

                    if (!string.IsNullOrEmpty(siteDwManage))
                    {
                        siteDwManageList += "|" + SiteID + "," + Utils.XmlRead(siteInfoXml, "SiteInfoConfig/SiteName", "") + "," + thisDwManage;
                    }
                    else
                    {
                        siteDwManageList = SiteID + "," + Utils.XmlRead(siteInfoXml, "SiteInfoConfig/SiteName", "") + "," + thisDwManage;
                    }
                }
                Utils.XmlUpdate(siteLoginXml, "SiteInfoManage/SiteDWMange", "", siteDwManageList);

                string siteOldDir = hidSiteDir.Value.ToLower().Trim();
                string siteNewDir = "";
                M_SiteParamConfig.SiteRootURL = this.txtSiteRootURL.Text;
                M_SiteParamConfig.SiteDir     = siteNewDir;
                //M_SiteParamConfig.SiteTempletDir = this.txtSiteTempletDir.Text;
                M_SiteParamConfig.SiteDomain = this.txtSiteDomain.Text;
                //M_SiteParamConfig.DisUserName = this.txtDisUserName.Text;
                M_SiteParamConfig.EditControl   = this.ddlEditControl.SelectedValue;
                M_SiteParamConfig.LogType       = this.ddlLogType.SelectedValue;
                M_SiteParamConfig.CreateFileExt = Request.Form["selCreateFileExt"];
                SiteParam.ConfigInfo            = M_SiteParamConfig;
                string publishType = Request.Form["radPublishType"];
                M_SiteParamConfig.PublishType = publishType;

                if (isMainDomain)  //如果是主站,则可以修改文件生成目录(为空或者main)
                {
                    if (radMainSiteDir1.Checked)
                    {
                        siteNewDir = "main";
                    }
                    if (siteOldDir != siteNewDir)  //修改了生成目录
                    {
                        try
                        {
                            if (siteNewDir == "main")                                                          //生成在main目录中
                            {
                                if (!Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main")))         //判断是否有main目录
                                {
                                    Directory.CreateDirectory(Server.MapPath("~/" + GetVirtualPath + "main")); //创建main目录
                                }
                                else if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/config")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/config"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "config"), Server.MapPath("~/" + GetVirtualPath + "main/config"));  //将配置文件移动到main目录

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/Plus")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/Plus"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "Plus"), Server.MapPath("~/" + GetVirtualPath + "main/Plus"));

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "IncludeFile"), Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"));

                                PhyFilePath = HttpContext.Current.Server.MapPath("~/" + GetVirtualPath + "main/config/SiteParam.config");

                                //File.Copy(Server.MapPath("~/" + GetVirtualPath + "web.config"), Server.MapPath("~/" + GetVirtualPath + "main/web.config"), true);  //拷贝web.config到main目录
                            }
                            else if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "main/config")))  //生成在根目录中,判断有没有有main/config/目录
                            {
                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "config")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "config"), true);
                                }

                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/config"), Server.MapPath("~/" + GetVirtualPath + "config"));  //移动main中的配置文件到根目录

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "Plus")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "Plus"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/Plus"), Server.MapPath("~/" + GetVirtualPath + "Plus"));

                                if (Directory.Exists(Server.MapPath("~/" + GetVirtualPath + "IncludeFile")))
                                {
                                    Directory.Delete(Server.MapPath("~/" + GetVirtualPath + "IncludeFile"), true);
                                }
                                Directory.Move(Server.MapPath("~/" + GetVirtualPath + "main/IncludeFile"), Server.MapPath("~/" + GetVirtualPath + "IncludeFile"));

                                PhyFilePath = HttpContext.Current.Server.MapPath("~/" + GetVirtualPath + "config/SiteParam.config");
                            }

                            //更新数据库中的Directory值
                            KingTop.BLL.SysManage.SysWebSite siteBll = new SysWebSite();
                            siteBll.SysWebSiteSet("EDITDIR", SiteID.ToString(), siteNewDir);
                            Session["SiteDir"] = siteNewDir;
                        }
                        catch
                        {
                            Utils.RunJavaScript(this, "alert({msg:'站点信息设置失败!',status: '2', title: '提示信息', time: 10000, width: 400})");
                            return;
                        }
                    }
                }
                bool b = SiteParam.SaveConfig(PhyFilePath);
                KingTop.WEB.BasePage.PublishType = publishType;

                //Utils.XmlUpdate(PhyFilePath, "SiteParamConfig/PublishType", "", publishType);
                if (!b)
                {
                    Utils.RunJavaScript(this, "alert({msg:'站点信息设置失败," + PhyFilePath.Replace("\\", "\\\\") + "文件没有修改权限!',status: '2', title: '提示信息', time: 10000, width: 400})");
                    return;
                }
                WriteLog("站点参数设置成功!", "", 2);
                Utils.RunJavaScript(this, "alert({msg:'站点参数设置成功!',title:'提示信息'})");
            }
            else
            {
                Utils.RunJavaScript(this, "alert({msg:'你没有修改站点参数设置的权限,请联系站点管理员!',title:'提示信息'})");
            }
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string fileExt      = string.Empty;
            string fileName     = string.Empty;
            string originalName = null;

            Response.ContentType = "text/plain";
            Response.Expires     = -1;

            //如果设置了水印和缩略图,则先将设置保存到cache,在上传图片
            string paramValue = Request["paramValue"];
            string paramKey   = Request["paramKey"];

            if (!string.IsNullOrEmpty(paramValue) && !string.IsNullOrEmpty(paramKey))
            {
                AppCache.AddCache(paramKey, paramValue, 60);
                Response.Write("OK");
                return;
            }

            //图片上传
            try
            {
                HttpPostedFile postedFile = Request.Files[0];



                SiteDir = GetUrlParam("SiteDir");
                string saveType = GetUrlParam("SaveType");
                string key      = GetUrlParam("param1");
                string ImgSet   = GetUrlParam("param2");
                if (!string.IsNullOrEmpty(key) && AppCache.IsExist(key))
                {
                    ImgSet = AppCache.Get(key).ToString();
                }
                if (string.IsNullOrEmpty(ImgSet))
                {
                    ImgSet = "0,0,0";  //
                }
                string[] arrImgSet = ImgSet.Split(',');
                thumbWidth  = Utils.ParseInt(arrImgSet[0], 0);
                thumbHeight = Utils.ParseInt(arrImgSet[1], 0);
                IsWater     = Utils.ParseInt(arrImgSet[2], 0);
                string UPType = GetUrlParam("UpType");
                fileName     = postedFile.FileName;
                originalName = fileName;
                fileExt      = Path.GetExtension(fileName).ToLower();
                string saveName = DateTime.Now.ToString("yyyyMMddhhmmsfff");  // 上传文件名

                if (string.IsNullOrEmpty(UPType))
                {
                    UPType = "image";
                }

                uploadobj = KingTop.Config.Upload.GetConfig(GetUploadImgPath); //上传设置信息

                if (uploadobj.IsEnableUpload != "1")                           // 判断是否允许上传
                {
                    state = "已经关闭上传功能,请联系管理员";
                }



                SavePath = "{0}";
                //文件保存在站点目录下,用下面代码,注释后将不分站点保存
                //if (!string.IsNullOrEmpty(SiteDir))
                //{
                //    SavePath += "/" + SiteDir;
                //}
                SavePath += "{1}";

                switch (UPType)
                {
                case "media":    //视频,flash
                    SavePath = string.Format(SavePath, uploadobj.MediaSavePath, "/Medias");
                    URL      = GetUploadUrl(uploadobj.MediaUrl, "Medias", SavePath);
                    AllowExt = "*.wav;*.avi;*.mpg;*.mpeg;*.wma;*.flv;*.swf";
                    MaxSize  = 100;
                    break;

                case "file":    //文件
                    SavePath = string.Format(SavePath, uploadobj.FileSavePath, "/Files");
                    URL      = GetUploadUrl(uploadobj.FileUrl, "Files", SavePath);
                    AllowExt = uploadobj.UploadFilesType;
                    break;

                case "image":    //图片
                    SavePath = string.Format(SavePath, uploadobj.ImageSavePath, "/Images");
                    URL      = GetUploadUrl(uploadobj.ImageUrl, "Images", SavePath);
                    AllowExt = uploadobj.UploadImageType;
                    break;

                case "flash":    //flash
                    SavePath = string.Format(SavePath, uploadobj.MediaSavePath, "/Medias");
                    URL      = GetUploadUrl(uploadobj.MediaUrl, "Medias", SavePath);
                    AllowExt = uploadobj.UploadMediaType;
                    break;

                default:
                    break;
                }

                if (AllowExt.IndexOf(fileExt.Replace(".", "")) == -1)
                {
                    state = "文件类型不允许上传!";
                }
                if (SystemConst.NOT_ALLOWED_UPLOAD_TYPE.IndexOf(fileExt.Replace(".", "")) != -1)
                {
                    state = "文件类型不允许上传!";
                }
                if (postedFile.ContentLength > MaxSize * 1024 * 1024)
                {
                    state = "文件大小超出网站限制!";
                }

                string reFilePath = URL;         // 返回文件路径,如果保存路径填写的是绝对地址,则返回文件路径为域名+系统创建路径,如果为相对地址,则为:域名+相对路径+系统创建路径
                if (SavePath.IndexOf(":") == -1) //判断输入的是虚拟路径
                {
                    SavePath = Server.MapPath(GetVirtualPath + SavePath);
                }
                SavePath = SavePath + "/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/";
                if (!Directory.Exists(SavePath))
                {
                    Directory.CreateDirectory(SavePath);
                }

                if (saveType == "1")  //使用原文件名进行保存到服务器
                {
                    int fileNameLength = fileName.LastIndexOf(".");
                    saveName = fileName.Substring(0, fileNameLength);
                }

                fileName = SavePath + saveName + fileExt;
                URL     += DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + saveName + fileExt;
                if (File.Exists(fileName) && saveType == "1")
                {
                    File.Delete(fileName);
                }
                postedFile.SaveAs(fileName);           //保存至服务器
                if (thumbWidth > 0 || thumbHeight > 0) //判断是否上传的是否需生成缩略图
                {
                    string thumbMode = "HW";
                    if (thumbWidth > 0 && thumbHeight == 0)
                    {
                        thumbMode = "W";
                    }
                    else if (thumbWidth == 0 && thumbHeight > 0)
                    {
                        thumbMode = "H";
                    }
                    KingTop.WEB.SysAdmin.UploadBase.MakeThumbnail(fileName, fileName + ".gif", thumbWidth, thumbHeight, thumbMode);     // 生成缩略图方法
                }

                if (IsWater == 1) //如果上传图片,则判断是否需要打水印
                {
                    KingTop.WEB.SysAdmin.UploadBase.ImageWater(uploadobj, fileName);
                }
            }
            catch (Exception ex)
            {
                state = ex.Message;
            }
            if (Request["action"] == "tmpImg")
            {
                Response.Write("<script>alert('bbbb');parent.ue_callback('" + URL + "','" + state + "')</script>");//回调函数
            }
            else
            {
                Response.Write("{'state':'" + state + "','url':'" + URL + "','fileType':'" + fileExt + "','original':'" + originalName + "'}"); //向浏览器返回数据json数据
            }
        }