Nucleus .Net Core CMS

Controls.FileSelector Class

Namespace: Nucleus.ViewFeatures.Controls
Assembly: Nucleus.ViewFeatures.dll
Provides a reusable file selector control for selecting files from the site's file system.
This ViewComponent renders a file selection UI, allowing users to browse, select, and preview files. It supports multiple file system providers, folder navigation, and permission checks.
FileSelector (Context Context, IFileSystemManager fileSystemManager)
Initializes a new instance of the Controls.FileSelector class.
Parameters
Name Type
Context Nucleus.Abstractions.Models.Context

The current Nucleus Context.

fileSystemManager Nucleus.Abstractions.Managers.IFileSystemManager

The file system manager instance.

Gets the current Nucleus Models.Context.
Gets the file system manager used to access files and folders.
InvokeAsync (Site site, File file, String pattern, String propertyName, String controllerName, String selectActionName, String selectAnotherActionName, String target, Boolean showSelectAnother, String noFilesMessage, Boolean showImagePreview)
Renders the file selector control.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site

The site to display files for. If not specfied, uses the current site.

file Nucleus.Abstractions.Models.FileSystem.File

The currently selected file, or null if no file is selected.

pattern String

A regular expression pattern to filter file names (optional).

propertyName String

The name of the property to bind the selected file to (defaults to "SelectedFile").

controllerName String

The name of the controller which handles the select another action.

selectActionName String

The name of the action to invoke when selecting a provider, folder or file (defaults to null, which causes the current action to be used).

selectAnotherActionName String

The name of the action to invoke when selecting another file (defaults to "SelectAnother").

target String

The data-target which identifies the section which is updated after selection events.

showSelectAnother Boolean

Whether to show the "Select Another" button (defaults to true).

noFilesMessage String

The message to display when no files are available (defaults to "(no files)").

showImagePreview Boolean

Whether to show an image preview for image files (defaults to false).

Returns
An Microsoft.AspNetCore.Mvc.IViewComponentResult that renders the file selector UI.
Remarks
This method prepares the view model, handles file and folder selection logic, applies permission checks, and returns the view for rendering.