To limit the number of files that can be uploaded in the Syncfusion Blazor File Upload component, you can use the FileSelected event.
Here's an example of how to implement this:
<div style="margin:100px auto; width:300px"> <SfUploader AllowMultiple="true" AutoUpload="false"> <UploaderEvents FileSelected="@FileSelectedHandler"></UploaderEvents> </SfUploader> @if(IsBool){ <span class="e-error">Maximum 5 files are allowed</span> } </div> @code { bool IsBool = false; private void FileSelectedHandler(SelectedEventArgs args) { if(args.FilesData.Count > 5 ) { args.Cancel = true; IsBool = true; } else { IsBool = false; } } } |