Skip to main content
A newer version of this page is available. .
Tab

FileManagerFolderAccessRule.Upload Property

Gets or sets the upload action permission.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(Rights.Default)]
public Rights Upload { get; set; }

Property Value

Type Default Description
Rights **Default**

One of the Rights enumeration values specifying the action permission.

Available values:

Name Description
Allow

The action is allowed within the access rule.

Deny

The action is denied within the access rule.

Default

The action has an identical permission as the current item (file or folder) parent element. It corresponds to the Rights.Allow permission if this value does not exist.

Remarks

ASPxFileManager allows you to define access permissions for folders and files using a set of file/folder access rules (FileManagerSettingsPermissions.AccessRules). An access rule specifies a path to which it is applied and lists permissions (allowed or denied actions) associated with this rule.

Use the Upload property to specify whether end-users with the specified role (FileManagerAccessRuleBase.Role) can upload files to a folder(s) specified in the current access rule (via the FileManagerAccessRuleBase.Path property).

Concept

Example

Web Forms (declaratively):

<dx:ASPxFileManager ID="ASPxFileManager1" runat="server">    
    <SettingsPermissions>
        <AccessRules>
            <dx:FileManagerFileAccessRule Edit="Deny" Browse="Allow" Path="*.docx" />
            <dx:FileManagerFolderAccessRule Role="Administrator"  EditContents="Allow" Browse="Allow" Upload="Allow" Path="Documents" />
        </AccessRules>
    </SettingsPermissions>
</dx:ASPxFileManager>

Web Forms (in code):

ASPxFileManager fm = new ASPxFileManager();
...
FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
fileRule.Path = "*.docx";
fileRule.Edit = Rights.Allow;
fileRule.Download = Rights.Allow;

FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
folderRule.Role = "Administrator";
folderRule.EditContents = Rights.Allow;
folderRule.Browse = Rights.Allow;
folderRule.Upload = Rights.Allow;

FileManager.SettingsPermissions.AccessRules.Add(fileRule);
FileManager.SettingsPermissions.AccessRules.Add(folderRule);
...

MVC:

@Html.DevExpress().FileManager( settings => {
    settings.Name = "fileManager";

    FileManagerFileAccessRule fileRule = new FileManagerFileAccessRule();
    fileRule.Path = "*.docx";
    fileRule.Edit = Rights.Allow;
    fileRule.Download = Rights.Allow;

    FileManagerFolderAccessRule folderRule= new FileManagerFolderAccessRule();
    folderRule.Role = "Administrator";
    folderRule.EditContents = Rights.Allow;
    folderRule.Browse = Rights.Allow;
    folderRule.Upload = Rights.Upload;

    FileManager.SettingsPermissions.AccessRules.Add(fileRule);
    FileManager.SettingsPermissions.AccessRules.Add(folderRule);
    ...
}).BindToFolder(Model).GetHtml()

Online Demo

Example

<dx:ASPxFileManager ID="FileManager" runat="server" ...>

...

     <SettingsPermissions>
          <AccessRules>
               <dx:FileManagerFolderAccessRule Path="" Edit="Deny" />
               <dx:FileManagerFileAccessRule Path="*.xml" Edit="Deny" />
               <dx:FileManagerFolderAccessRule Path="System" Browse="Deny" />

               <dx:FileManagerFolderAccessRule Path="Documents" Role="DocumentManager" EditContents="Allow" />

               <dx:FileManagerFolderAccessRule Path="Music" Role="MediaModerator" EditContents="Allow" />
               <dx:FileManagerFolderAccessRule Path="Video" Role="MediaModerator" EditContents="Allow" />
               <dx:FileManagerFolderAccessRule Path="" Role="MediaModerator" Upload="Deny" />

               <dx:FileManagerFolderAccessRule Role="Administrator" Edit="Allow" Browse="Allow" />
          </AccessRules>
     </SettingsPermissions>
</dx:ASPxFileManager>
See Also