国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
CuteEditor5.0實(shí)現(xiàn)分用戶上傳
由于公司的需要分用戶上傳功能,剛開始接觸CuteEditor覺得很頭痛,在網(wǎng)上這方面資料很少很少,都只說可以實(shí)現(xiàn)但確都沒有寫下代碼,后來自己看了看,發(fā)現(xiàn)在CuteEditor上傳是通過配置文件進(jìn)行的,我想如果給每個(gè)用戶都寫一個(gè)配置文件此問題不就解決了,然后就拿起家伙開始辦事,發(fā)現(xiàn)還真行,呵呵,以下是實(shí)現(xiàn)代碼!

CuteSoft_Client/CuteEditor/Configuration/Security是上文件的一些配置文件,其中包含了三個(gè)文件:Admin.config,Default.config,Guest.config配置文件里就是一些上傳大小呀,上傳路徑等

修改一下<security name="ImageGalleryPath">~/uploads</security>就知道,上傳就是根據(jù)這里來的

執(zhí)行流程就是 給用戶先創(chuàng)建一配置文件,然后在給他一上傳圖片的文件夾路徑,在把控件指向該用戶的配置文件就可以了,這樣就實(shí)現(xiàn)了分用戶上傳的功能

    protected void Page_Load(object sender, EventArgs e)
    
{
        
if (!IsPostBack)
        
{

           
/ /這里選擇不同用戶登錄的用戶名
            CreateDict(
"admin");

            
////根據(jù)用戶讀取配置文件
            Editor1.SecurityPolicyFile = "admin.config";
        }

    }



    
////創(chuàng)建配置文件及上傳文件夾
    private void CreateDict(string strName)
    
{
        
if (!File.Exists(Server.MapPath("~/CuteSoft_Client/CuteEditor/Configuration/Security/" + strName + ".config")))
       
{
            
//復(fù)制一個(gè)原有的配置文件
            File.Copy(Server.MapPath("~/CuteSoft_Client/CuteEditor/Configuration/Security/admin.config"), Server.MapPath("~/CuteSoft_Client/CuteEditor/Configuration/Security/" + strName + ".config"));

            
//通過xml文檔對(duì)象讀取xml文件
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(Server.MapPath(
"~/CuteSoft_Client/CuteEditor/Configuration/Security/" + strName + ".config"));

            
//查找結(jié)點(diǎn)
           XmlNodeList xmlList = xDoc.SelectSingleNode("configuration").SelectNodes("security");

            
//遍歷結(jié)點(diǎn)
            foreach(XmlNode xNode in xmlList)
            
{
                
//轉(zhuǎn)換成登錄者的地址s
                switch (xNode.Attributes["name"].Value)
                
{
                    
case "ImageGalleryPath": xNode.InnerText = xNode.InnerText + "/" + strName; break;
                    
case "MediaGalleryPath": xNode.InnerText = xNode.InnerText + "/" + strName; break;
                    
case "FlashGalleryPath": xNode.InnerText = xNode.InnerText + "/" + strName; break;
                    
case "FilesGalleryPath": xNode.InnerText = xNode.InnerText + "/" + strName; break;
                }

            }


            
//保存變化設(shè)置
            xDoc.Save(Server.MapPath("~/CuteSoft_Client/CuteEditor/Configuration/Security/" + strName + ".config"));

            
//建立新目錄
           if (!Directory.Exists(Server.MapPath("~/uploads/" + strName + "")))
                Directory.CreateDirectory(Server.MapPath(
"~/uploads/" + strName + ""));
       }

    }
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
web.config配置文件格式
Machine.Config 和 Web.Config
用XML文件保存配置信息的一個(gè)類(C#)
Web.config配置文件詳解
web.config優(yōu)化網(wǎng)站性能設(shè)置
考察ASP.NET 2.0Membership,Roles,Profile
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服