FileManager Class

The component for browsing and managing files with access control.

Definition

Namespace: GleamTech.FileUltimate.AspNet.UI
Assembly: GleamTech.FileUltimate (in GleamTech.FileUltimate.dll) Version: 9.1.3
C#
public sealed class FileManager : StatefulComponent<FileManagerState>
Inheritance
Object    Component    StatefulComponent    StatefulComponentFileManagerState    FileManager

Example

C#
@using GleamTech.AspNet.Mvc
@using GleamTech.FileUltimate.AspNet.UI

<!DOCTYPE html>
@{
    var fileManager = new FileManager
    {
        Width = 800,
        Height = 600,
        Resizable = true
    };

    var rootFolder = new FileManagerRootFolder
    {
        Name = "A Root Folder",
        Location = "~/App_Data/RootFolder1"
    };

    rootFolder.AccessControls.Add(new FileManagerAccessControl
    {
        Path = @"\",
        AllowedPermissions = FileManagerPermissions.Full
    });

    fileManager.RootFolders.Add(rootFolder);
}
<html>
    <head>
        <title>File Manager</title>
        @this.RenderHead(fileManager)
    </head>
    <body>
        @this.RenderBody(fileManager)
    </body>
</html>

Note that for ASP.NET Core, you also need to add and register GleamTech in Startup.cs, please see Using FileUltimate in an ASP.NET Core project.

Constructors

FileManager Initializes a new instance of the FileManager class.
FileManager(FileUltimateWebConfiguration) Initializes a new instance of the FileManager class with custom web configuration.

Properties

ArchiveBrowsingEnabled Gets or sets a value that specifies whether browsing inside archive files (.zip etc.) like regular folders should be enabled. Default is true.
CheckboxSelectionEnabled Gets or sets a value that specifies whether "Item check boxes" mode should be forced regardless of being detected as a touch device. Default is false.
Chooser Gets or sets a value that specifies whether the component should be displayed as a file/folder chooser. Default is false. In chooser mode, "Choose" and "Cancel" buttons will be displayed at the bottom of the component and double-clicking on a item of allowed type will choose that item instead of doing the default action (download/explore).
ChooserMultipleSelection Gets or sets a value that specifies whether multiple item selection should be allowed in chooser mode. Default is false.
ChooserType Gets or sets the item type that should be allowed to be chosen in chooser mode. Default is File. Possible values are File, Folder and FileOrFolder.
ClientEventsGets or sets the client-side event handlers.
CollapseRibbon Gets or sets a value that specifies whether the ribbon (top toolbar pane) is displayed in collapsed mode. Default is false.
CompressionMaxSize Gets or sets the maximum allowed size to compress (per action). If not set (null), there will be no size limit for compression. 0 (zero) also means unlimited.

This property can be used to prevent users creating large zip files (or other compressed archive files in future) which is CPU intensive. It can be set in <Number> B/KB/MB/GB/TB format (eg. 1024 or 1024 B, 200 KB, 30 MB, 5 GB, 1 TB). Note that this value is the uncompressed size for the action because it's not possible to determine the compressed size before actually doing the compression.

DebugMode Gets or sets a value indicating whether to display detailed error messages for troubleshooting. Exceptions will be displayed with stack trace, inner exceptions and data.
(Inherited from StatefulComponent)
DisplayLanguage Gets or sets the display (user interface) language of the file manager. It is usually set as the two-letter language names like en, de, fr etc. as the bundled languages are usually for general language names. However it can be also set to specific cultures like en-US, de-DE, fr-FR etc. For example, if the property is set to a specific culture like de-CH (German in Switzerland), the component will first look for the language file FileUltimate-de-CH.xml and if the file is not found, it will load the general (fallback) language file of that culture which is FileUltimate-de.xml. If not set, the language file which matches the current UICulture of the host application will be loaded. If there is no language file which matches the current UICulture or its fallback, then the default language file FileUltimate.xml is loaded.
DisplayModeGets or sets a value indicating whether the component is rendered as InPlace (default), Panel, Window or Viewport.
(Inherited from Component)
DocumentViewerEnabled Gets or sets a value that specifies whether viewer for document files should be enabled. Default is true.
DownloadOnDoubleClick Gets or sets a value that specifies whether "Download" action should be triggered when you double-click on a file. Default is false. When not set, "Preview" action will be triggered and if "Preview" permission is not allowed or the file type is not preview-able by any of the built-in viewers, then "Open" (open inline in browser or open locally) action will be triggered.
DownloadWithChunkedTransferThreshold Gets or sets the threshold to start using chunked downloading. If not set (null), there will be no chunked downloading. 0 (zero) also means no chunked downloading.

This property is only useful if you have problems downloading large files due to your environment limitations (reverse proxy etc.). For example, Microsoft Forefront UAG can not parse http responses when content-length is larger than 2GB (throws HTTP 500 due to 32-bit integer limit). By setting this property to 2GB, files up to 2GB will be sent with content-length set (default download method) but files larger than 2GB will be sent without content-length and with chunked-transfer encoding so that you can bypass UAG's limitation and successfully download the files. The reason this setting is specified as a threshold is that default download method (content-length set) is always better as it allows the browser to know the whole file size thus show progress information. However with chunked-transfer encoding, the browser will not know the whole file size so it will not be able to show progress information but it will still be able to download the file as long as it receives the stream. So users downloading files smaller than this threshold should not be punished with indeterminate progress but also users downloading files larger than this threshold should still be able to successfully download even there is no progress.

ExcludedExtensionsForPreview Gets or sets a comma-separated file extensions (e.g. "docx, jpg, mp4") to exclude from previewing. "Preview" action for these file extensions will be disabled.
FormatLanguage Gets or sets the format language of the file manager. Format language is used for the number and date/time formats. It is usually set as the specific cultures like en-US, de-DE, fr-FR etc. If not set, the current Culture of the host application will be used.
HeightGets or sets the height of the component.
(Inherited from Component)
Hidden Gets or sets a value indicating whether the component is displayed when page is loaded. When set to false, the component can be displayed later on client-side manually. For example, the component can be displayed via a button's click event.
(Inherited from Component)
Id Gets or sets the HTML id of the component. Also a javascript variable with the same name is automatically defined and it can be used to access the client-side implementation of the component. If omitted, Id will be automatically set to the class name of this component (e.g camel-case className) and if there are other instances on the same page, to className2 ... classNameX.
(Inherited from Component)
ImageThumbnailsEnabled Gets or sets a value that specifies whether thumbnails for image files should be displayed. Default is true.
ImageViewerEnabled Gets or sets a value that specifies whether viewer for image files should be enabled. Default is true.
InitialFolder Gets or sets the folder that should be selected and displayed initially. Default is "first". The value can be shortcuts like "first", "last" or the full path of the folder specified in format "[RootFolderName]:\Some\Folder". When set to null or empty string, no folder will be selected and displayed initially.
MediaPlayerEnabled Gets or sets a value that specifies whether player for video and audio files should be enabled. Default is true.
OpenInBrowserEnabled Gets or sets a value that specifies whether opening files in browser should be enabled. Default is true.
PanelOptionsGets or sets the panel options used for Panel mode.
(Inherited from Component)
ProductInfoRenderedGets or sets a value indicating whether product info/copyright comment is rendered in html.
(Inherited from Component)
Resizable Gets or sets a value that specifies if the component can be resized when the user drags sides.
(Inherited from Component)
ResizeHandles Gets or sets a value that specifies the handles which can be used for resizing the component. Default is South, East and SouthEast. When using Window mode, set ResizeHandles which overrides this property.
(Inherited from Component)
RootFolders Gets the collection of the root folders to display in the file manager.
ShowFileExtensions Gets or sets a value that specifies whether the extension part of the file names should be be displayed. Default is false. When this set to true, the file extension will be also editable in dialog boxes when user is prompted (eg. on Rename and Add to Zip actions).
ShowFoldersPane Gets or sets a value that specifies whether the folders pane (left pane) is displayed. Default is true.
ShowHiddenFilesAndFolders Gets or sets a value that specifies whether hidden files and subfolders should be displayed. Default is false.
ShowRibbon Gets or sets a value that specifies whether the ribbon (top toolbar pane) is displayed. Default is true.
ShowSystemFilesAndFolders Gets or sets a value that specifies whether system files and subfolders should be displayed. Default is false.
ShowSystemTypeDescriptions Gets or sets a value that specifies whether file and folder type descriptions from the system's registry (eg. Microsoft Word Document) should be displayed. Default is false. If set to false, then simple but current language dependant type descriptions (eg. DOC File) will be shown. If registry access is not be possible, even if this property is enabled, simple type descriptions will be shown.
SortRootFolders Gets or sets a value that specifies whether the root folders should be listed in alphabetically sorted order. Default is false. When not set, the root folders are listed in the original collection order.
StateId Gets or sets the state id of the component. This is determined automatically when state is saved to session.
(Inherited from StatefulComponent)
UploadChunkSize

Gets or sets the chunk size used in chunked uploading mode. The default is usually 28.6 MB (or 4MB for ASP.NET Classic before 4.5). The default and highest value is determined from Web.config. For ASP.NET Core and ASP.NET Classic 4.5+, it is determined only from system.webServer/requestLimits/maxAllowedContentLength property in Web.Config. For ASP.NET Classic before 4.5, it is determined additionally from system.web/httpRuntime/maxRequestLength property in Web.Config.

With chunked uploading mode, which is the default mode on modern browsers, file is split into chunks and chunks are uploaded one by one, and then chunks are reassembled back on the server. The reason for using chunked uploading when possible, is to overcome server's default request limitations. By using chunking, normally you don't need to change any settings to allow uploading of very large files out of the box. Currently all upload methods except Html4 uses chunked uploading (Html5 or Flash or Silverlight), this is because Html4 cannot split into chunks and can only send the whole file in a single request (multipart/form-data).

Information on various request size limits:

  • IIS by default has 30000000 (28.6 MB) request size limit, controlled by system.webServer/requestLimits/maxAllowedContentLength property in Web.Config, in bytes, maximum value is 4294967295 (4 GB). However maximum value is 2147483647 (2 GB) when the application is running under the NET 4.5 Integrated Pipeline Application Pool. This setting effects FileUploader, as it is an IIS setting, FileUploader cannot automatically override it.
  • ASP.NET Core by default has 30000000 (28.6 MB) request size limit, controlled by IHttpMaxRequestBodySizeFeature.MaxRequestBodySize property in code, in bytes, maximum value is unlimited if null. This setting does not effect FileUploader, i.e FileUploader can automatically override it.
  • ASP.NET Classic by default has 4096 (4 MB) request size limit, controlled by system.web/httpRuntime/maxRequestLength property in Web.Config, in kilobytes, maximum value is 2097151 (2 GB). This setting effects FileUploader only if you are running under server runtime lower than ASP.NET Classic 4.5 version, i.e when FileUploader cannot automatically override it.
UploadMaxFileCount Gets or sets the maximum allowed file count to upload. If not set, there will be no size limit for upload. 0 (zero) also means unlimited.
UploadMaxFileSize Gets or sets the maximum allowed file size to upload. If not set (null), there will be no size limit for upload. 0 (zero) also means unlimited.
UploadMethods Gets or sets a comma separated upload methods in priority order. The default value is "Html5, Silverlight, Flash, Html4". It's not recommended to change this property as the default order offers the best upload experience.
VideoThumbnailsEnabled Gets or sets a value that specifies whether thumbnails for video files should be displayed. Default is true.
ViewLayout Gets or sets the initial view layout type for listing files and folders on the right pane. Default is LargeIcons. Possible values are ExtraLargeIcons, LargeIcons, MediumIcons, SmallIcons, Details and Tiles.
WidthGets or sets the width of the component.
(Inherited from Component)
WindowOptionsGets or sets the windows options used for Window mode.
(Inherited from Component)

Events

CompressedOccurs after user compresses (zips) a file or folder in file manager.
CompressingOccurs before user compresses (zips) a file or folder in file manager.
CopiedOccurs after user copies a file or folder in file manager.
CopyingOccurs before user copies a file or folder in file manager.
CreatedOccurs after user creates a file or folder in file manager.
CreatingOccurs before user creates a file or folder in file manager.
DeletedOccurs after user deletes a file or folder in file manager.
DeletingOccurs before user deletes a file or folder in file manager.
DownloadedOccurs after user downloads a file or folder in file manager.
DownloadingOccurs before user downloads a file or folder in file manager.
ExpandedOccurs after user expands a folder in file manager.
ExpandingOccurs before user expands a folder in file manager.
ExtractedOccurs after user extracts (unzips) a file or folder in file manager.
ExtractingOccurs before user extracts (unzips) a file or folder in file manager.
FailedOccurs when an action in file manager fails.
ListedOccurs after user lists a folder in file manager.
ListingOccurs before user lists a folder in file manager.
MovedOccurs after user moves a file or folder in file manager.
MovingOccurs before user moves a file or folder in file manager.
PreviewedOccurs after user previews a file or folder in file manager.
PreviewingOccurs before user previews a file or folder in file manager.
RenamedOccurs after user renames a file or folder in file manager.
RenamingOccurs before user renames a file or folder in file manager.
UploadedOccurs after user uploads a file or folder in file manager.
UploadingOccurs before user uploads a file or folder in file manager.

See Also