The Blazor Bootstrap FileInput component provides a standard Bootstrap file control with validation and removal. The examples below cover multiple files and removal, sizes, validation, form validation and hint text and unrestricted extensions.
FileInput validates sizes, counts, and extensions selected from the file dialog. Configure validation-message templates with {FileName}, {MaxFileSize}, {AllowedFileTypes}, or {MaxFileCount} where applicable; the single-file message is static.
Select up to three PDF or PNG files, each no larger than 1 MB.
<FileInput Multiple="true"
MaxFileCount="3"
MaxFileSize="1048576"
AllowedFileTypes="@allowedFileTypes"
InvalidFileTypeErrorMessage="{FileName} must use one of: {AllowedFileTypes}."
MaxFileCountErrorMessage="{FileName} would exceed the {MaxFileCount}-file limit."
MaxFileSizeErrorMessage="{FileName} exceeds the {MaxFileSize}-byte limit."
SingleFileErrorMessage="Select only one file."
HintText="Select up to three PDF or PNG files, each no larger than 1 MB." />
@code {
private readonly string[] allowedFileTypes = [".pdf", "png"];
}