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.
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"
})
folder | The target |
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". |