DxFileInput.MaxFileCount Property
Specifies the maximum number of files that users can add to the file list.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(1000)]
[Parameter]
public int MaxFileCount { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Int32 | 1000 | The maximum number of files. |
Remarks
Once a user selects files in the Open dialog or drags files onto a drop zone, the File Input component adds these files to the file list. In Instant
upload mode (default), the component starts to upload a file once it appears in the file list. In OnClick
upload mode, the File Input starts to upload a file once a user clicks an upload button.
Enable the AllowMultiFileUpload property to allow users to add multiple files to the file list simultaneously. The MaxFileCount
property specifies the maximum file list size. When the file list reaches its size limit, users can add new files only once they remove one or more uploaded files.
Note
We do not recommend that you increase the MaxFileCount
property value beyond 1000
(default). However, you can set this property to 0
to remove the file list’s size limit.
The following example sets the file list’s size limit to 10
:
<DxFileInput FilesUploading="OnFilesUploading" AllowMultiFileUpload="true" MaxFileCount="10" />
@code {
async Task OnFilesUploading(FilesUploadingEventArgs args) {
foreach (var file in args.Files) {
/* The following code is intended for demonstration purposes only.
Do not read a stream directly in memory to avoid performance and security-related issues. */
using var stream = new System.IO.MemoryStream();
await file.OpenReadStream(file.Size).CopyToAsync(stream);
}
}
}