Nucleus .Net Core CMS

Controls.FileUpload Class

Namespace: Nucleus.ViewFeatures.Controls
Assembly: Nucleus.ViewFeatures.dll
Represents a file upload control as a view component for use in Razor views.
This control provides a user interface for uploading files to a specified folder in the file system. It supports configuration of the target folder, file type filtering, and UI customization.
FileUpload (Context Context, IFileSystemManager fileSystemManager)
Initializes a new instance of the Controls.FileUpload class.
Parameters
Name Type
Context Nucleus.Abstractions.Models.Context

he current Nucleus Context.

fileSystemManager Nucleus.Abstractions.Managers.IFileSystemManager

The file system manager instance.

Gets the current Nucleus Context.
Gets the file system manager used to interact with folders and files.
InvokeAsync (Site site, Folder folder, String filter, String controllerName, String actionName, String controlName, String target, String text, String cssClass)
Renders the file upload control.
Parameters
Name Type
site Nucleus.Abstractions.Models.Site

The site to show folders for/upload files to. If not specified, defaults to the current site.

folder Nucleus.Abstractions.Models.FileSystem.Folder

The target Models.FileSystem.Folder where files will be uploaded.

filter String

A string that defines the file types the file input should accept. This is used as the value of the accept attribute on the rendered upload control. Accept attribute

controllerName String

The name of the controller which handles uploads

actionName String

The name of the controller action to handle the upload. Defaults to "UploadFile".

controlName String

The HTML control name. Defaults to "mediaFile".

target String

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

text String

The button text. Defaults to "Upload File".

cssClass String

The CSS class for the upload button. Defaults to "btn btn-secondary btn-sm ms-auto align-items-center".

Returns
An Microsoft.AspNetCore.Mvc.IViewComponentResult that renders the file upload UI.
Remarks
The control checks user permissions and folder capabilities before enabling file uploads.