Aspnetcore: Add Support for More than 10 files in InputFile Component Blazor

Created on 29 Sep 2020  路  3Comments  路  Source: dotnet/aspnetcore

Currently when I try to import more than 10 files in Blazor WebAssembly with

<InputFile OnChange="OnInputFileChange" />

I am greeted with the following exception

Uncaught (in promise) Error: System.InvalidOperationException: The maximum number of files accepted is 10, but 12 were supplied.
   at Microsoft.AspNetCore.Components.Forms.InputFileChangeEventArgs.GetMultipleFiles(:5001/ic/c/Int32 maximumFileCount)
   at AI.Play.Components.ClassModifyView.OnInputFileChange(:5001/ic/c/InputFileChangeEventArgs e) in C:\Users\shive\Desktop\test\AI.Play\AI.Play\Components\ClassModifyView.razor:line 76
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(:5001/ic/c/Task task)

also for some reasons files more than ~512000 Bytes size fails to import.

Answered Resolved area-blazor blazor-wasm question

All 3 comments

@sps014 thanks for contacting us.

@campersau answer is correct, if you want a value different than the defaults, you need to be explicit about it.

@campersau , @javiercn Thanks it, helped

Was this page helpful?
0 / 5 - 0 ratings