コード例 #1
0
        public string Files(string Identifier, string uid)
        {
            string result      = string.Empty;
            string ControlName = string.Empty;

            if (!string.IsNullOrEmpty(Identifier) && PortalSettings != null && UserInfo != null)
            {
                List <IUIData> settings = new List <IUIData>
                {
                    new UIData {
                        Name = "AllowedAttachmentFileExtensions", Value = Entities.FileSetting.FileType
                    },
                    new UIData {
                        Name = "MaxFileSize", Value = Entities.FileSetting.FileSize.ToString()
                    }
                };

                if (HttpContext.Current.Request.Form.AllKeys.Contains("logotype"))
                {
                    ControlName = HttpContext.Current.Request.Form.Get("logotype");
                }

                if (ControlName == "FavIcon")
                {
                    result = BrowseUploadFactory.UploadFile(Identifier, HttpContext.Current, PortalSettings, new ModuleInfo(), UserInfo, isUploadAllowed(ActiveModule, UserInfo), "ico", 100, AppFactory.GetAppInformation().Name, uid);
                }

                else
                {
                    result = BrowseUploadFactory.UploadFile(Identifier, HttpContext.Current, PortalSettings, new ModuleInfo(), UserInfo, isUploadAllowed(ActiveModule, UserInfo), getFileTypes(settings), getMaxSize(Identifier, settings), AppFactory.GetAppInformation().Name, uid);
                }
            }
            return(result);
        }
コード例 #2
0
        public string Files(string Identifier, string uid)
        {
            string result      = string.Empty;
            string ControlName = string.Empty;

            if (!string.IsNullOrEmpty(Identifier) && PortalSettings != null && UserInfo != null)
            {
                if (HttpContext.Current.Request.Form.AllKeys.Contains("ControlName"))
                {
                    ControlName = HttpContext.Current.Request.Form.Get("ControlName");
                }

                int FolderID = BrowseUploadFactory.GetRootFolder(PortalSettings.Current.PortalId).FolderID;
                if (string.IsNullOrEmpty(uid))
                {
                    result = BrowseUploadFactory.UploadFile(Identifier, HttpContext.Current, PortalSettings, new ModuleInfo(), UserInfo, isUploadAllowed(ActiveModule, UserInfo, ControlName), "jpg,jpeg,png,gif,pdf,zip,rar,xls,xlsx,css,xml,doc,docx,webp", 100, AppFactory.GetAppInformation().Name, uid, FolderID);
                }
            }
            return(result);
        }
コード例 #3
0
        public string Files(string Identifier, string uid)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(Identifier) && PortalSettings != null && UserInfo != null)
            {
                List <IUIData> settings = new List <IUIData>
                {
                    new UIData {
                        Name = "AllowedAttachmentFileExtensions", Value = FileSetting.FileType
                    },
                    new UIData {
                        Name = "MaxFileSize", Value = FileSetting.FileSize.ToString()
                    }
                };
                if (settings != null && settings.Count > 0)
                {
                    result = BrowseUploadFactory.UploadFile(Identifier, HttpContext.Current, PortalSettings, new ModuleInfo(), UserInfo, isUploadAllowed(UserInfo), getFileTypes(settings), getMaxSize(Identifier, settings), AppFactory.GetAppInformation().Name, null);
                }
            }
            return(result);
        }
コード例 #4
0
        public string Files(string Identifier, string uid)
        {
            string result      = string.Empty;
            string ControlName = string.Empty;
            int?   UserID      = null;

            if (!string.IsNullOrEmpty(Identifier) && PortalSettings != null && UserInfo != null)
            {
                List <IUIData> settings = new List <IUIData>
                {
                    new UIData {
                        Name = "AllowedAttachmentFileExtensions", Value = FileSetting.FileType
                    },
                    new UIData {
                        Name = "MaxFileSize", Value = FileSetting.FileSize.ToString()
                    }
                };

                if (HttpContext.Current.Request.Form.AllKeys.Contains("ControlName"))
                {
                    ControlName = HttpContext.Current.Request.Form.Get("ControlName");
                }

                if (HttpContext.Current.Request.Form.AllKeys.Contains("UserID"))
                {
                    UserID = Convert.ToInt32(HttpContext.Current.Request.Form.Get("UserID"));
                    if (UserID.HasValue)
                    {
                        UserInfo User     = DotNetNuke.Entities.Users.UserController.Instance.GetUser(PortalSettings.Current.PortalId, UserID.Value);
                        int      folderid = FolderManager.Instance.GetUserFolder(User).FolderID;
                        if (string.IsNullOrEmpty(uid))
                        {
                            result = BrowseUploadFactory.UploadFile(Identifier, HttpContext.Current, PortalSettings, new ModuleInfo(), UserInfo, isUploadAllowed(ActiveModule, UserInfo, ControlName), getFileTypes(settings), getMaxSize(Identifier, settings), AppFactory.GetAppInformation().Name, uid, folderid);
                        }
                    }
                }
            }
            return(result);
        }