Nucleus .Net Core CMS

FileUpload Control

Overview

The FileUpload control (View Component) provides a reusable user interface (button) for uploading files to a specified folder in the file system. It supports configuration of the target folder, file type filtering, and UI customization and is often used alongside a File Selector control.

Usage

Add a FileUpload control to your Razor view using code like this:

@await Component.InvokeAsync(typeof(Nucleus.ViewFeatures.Controls.FileUpload), new 
{ 
  folder = Model.SelectedCssFile?.Parent, 
  actionName = "UploadCssFile", 
  controlName = "CssFile", 
  filter = ".css" 
})

Parameters

folder The target where files will be uploaded.
filter 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.
actionName The name of the controller action to handle the upload. Defaults to "UploadFile".
controlName The HTML control name. Defaults to "mediaFile".
text The button text. Defaults to "Upload File".
cssClass The CSS class for the upload button. Defaults to "btn btn-secondary btn-sm ms-auto align-items-center".

Notes

  • The File Upload control is often used alongside a File Selector control to allow users to upload new files directly from your user interface.