Re: change upload-path dynamically

  •  08-08-2005, 12:06 PM

    Re: change upload-path dynamically

    Yes, below is an example:
     
    private void security_Changed(Object sender, EventArgs e)
            {
                string temp = "";
                switch(RadioList.SelectedItem.Value)
                {
                    case "Administrators":
                        Editor1.SecurityPolicyFile  = "Admin.config";
                        SetUploadsFolder("~/Uploads/");
                        break;
                    case "Members":
                        Editor1.SecurityPolicyFile  = "default.config";
                        SetUploadsFolder("~/Uploads/Member/");
                        break;
                    case "Guest":
                        Editor1.SecurityPolicyFile  = "Guest.config";
                        SetUploadsFolder("~/Uploads/Guest/");
                        break;
            //        case "Banned":
            //            Editor1.ReadOnly = true;
            //            break;
                    case "John":
                        Editor1.SecurityPolicyFile  = "Admin.config";
                        SetUploadsFolder("~/Uploads/Users/John/");
                        break;
                    case "Mary":
                        Editor1.SecurityPolicyFile  = "default.config";
                        SetUploadsFolder("~/Uploads/Users/Mary/");
                        break;
                    case "Tim":
                        Editor1.SecurityPolicyFile  = "default.config";
                        SetUploadsFolder("~/Uploads/Users/Tim/");
                        break;
                }
            }        
                        
            void SetUploadsFolder(string folder)
            {
                string phyfolder=Server.MapPath(folder);
                System.IO.Directory.CreateDirectory(phyfolder);
                
                //see security.config
                Editor1.Setting["security:ImageGalleryPath"]=
                Editor1.Setting["security:MediaGalleryPath"]=
                Editor1.Setting["security:FlashGalleryPath"]=
                Editor1.Setting["security:FilesGalleryPath"]=
                    folder;
            }
    
            </script>    

    You can find it in Personalization and Programmatic Security Example.
     
    Keep me posted.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread