Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5145,6 +5145,12 @@
Raise when a file raised an error. Not yet used.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFile.OnFileCountExceeded">
<summary>
Raised when the <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFile.MaximumFileCount"/> is exceeded.
The return parameter specifies the total number of files that were attempted for upload.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFile.OnCompleted">
<summary>
Raise when all files are completely uploaded.
Expand Down
13 changes: 12 additions & 1 deletion src/Core/Components/InputFile/FluentInputFile.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ public FluentInputFile()
[Parameter]
public EventCallback<FluentInputFileEventArgs> OnFileError { get; set; }

/// <summary>
/// Raised when the <see cref="MaximumFileCount"/> is exceeded.
/// The return parameter specifies the total number of files that were attempted for upload.
/// </summary>
[Parameter]
public EventCallback<int> OnFileCountExceeded { get; set; }

/// <summary>
/// Raise when all files are completely uploaded.
/// </summary>
Expand Down Expand Up @@ -215,7 +222,11 @@ protected async Task OnUploadFilesHandlerAsync(InputFileChangeEventArgs e)
{
if (e.FileCount > MaximumFileCount)
{
throw new ApplicationException($"The maximum number of files accepted is {MaximumFileCount}, but {e.FileCount} were supplied.");
if (OnFileCountExceeded.HasDelegate)
{
await OnFileCountExceeded.InvokeAsync(e.FileCount);
}
return;
}

// Use the native Blazor event
Expand Down
Loading