Blazorise FileInput component
Input component with support for single of multi file upload.
API
Parameters
| Parameter | Description | Type | Default |
|---|---|---|---|
AriaDescribedBy |
Specifies the aria-describedby attribute value. RemarksWhen set, this value is rendered as-is and overrides help and validation message ids generated by Field and Validation. |
string | |
AriaInvalid |
Specifies the aria-invalid attribute value. RemarksWhen set, this value is rendered as-is and overrides the validation-derived aria-invalid state. |
string | |
AriaLabelledBy |
Specifies the aria-labelledby attribute value. RemarksWhen set, this value is rendered as-is. Some non-labelable controls can otherwise derive it automatically from a parent FieldLabel or FieldsLabel. |
string | |
AriaRequired |
Specifies the aria-required attribute value. RemarksWhen set, this value overrides the required-field state resolved from the parent Validation. |
bool | false |
Autofocus |
Set's the focus to the component after the rendering is done. |
bool | false |
AutoReset |
If true file input will be automatically reset after it has being uploaded. |
bool | true |
BrowseButtonLocalizer |
Function used to handle custom localization that will override a default ITextLocalizer. |
TextLocalizerHandler | null |
ChildContent |
Specifies the content to be rendered inside this FileInput. |
RenderFragment | null |
Directory |
Determines whether file picker should upload directories. |
bool | false |
Disabled |
Add the disabled boolean attribute on an input to prevent user interactions and make it appear lighter. |
bool | false |
DisableProgressReport |
Determines whether report progress should be disabled. By enabling this setting, Progressed and Written callbacks won't be called. Internal file progress won't be tracked. This setting can speed up file transfer considerably. |
bool | false |
Feedback |
Placeholder for validation messages. |
RenderFragment | null |
Filter |
Specifies the types of files that the input accepts. See w3schools.com. |
string | |
MaxChunkSize |
Specifies the max chunk size when uploading the file. Take note that if you're using IFileEntry,CancellationToken) you're provided with a stream and should configure the chunk size when handling with the stream. RemarksSee docs.microsoft.com. |
int | 20 * 1024 |
MaxFileSize |
Maximum file size in bytes, checked before starting upload (note: never trust client, always check file size at server-side). Defaults to long.MaxValue. |
long | long.MaxValue |
Multiple |
Enables the multiple file selection. |
bool | false |
Placeholder |
Sets the placeholder for the empty file input. |
string | |
ReadOnly |
Add the readonly boolean attribute on an input to prevent modification of the input’s value. |
bool | false |
SegmentFetchTimeout |
Specifies the Segment Fetch Timeout when uploading the file. |
TimeSpan | TimeSpan.FromMinutes( 1 ) |
Size |
Sets the size of the input control. |
Size? | null |
TabIndex |
If defined, indicates that its element can be focused and can participates in sequential keyboard navigation. |
int? | null |
Value |
Specifies the value inside the input field. |
TValue | null |
ValueExpression |
Specifies an expression that identifies the input value. |
Expression<Func<TValue>> | null |
Events
| Event | Description | Type |
|---|---|---|
Blur |
The blur event fires when an element has lost focus. |
EventCallback<FocusEventArgs> |
Changed |
Occurs every time the selected file has changed, including when the reset operation is executed. |
EventCallback<FileChangedEventArgs> |
CustomValidationValue |
Used to provide custom validation value on which the validation will be processed with the Validator handler. RemarksShould be used carefully as it's only meant for some special cases when input is used in a wrapper component, like Autocomplete or SelectList. |
Func<TValue> |
Ended |
Notifies when an individual file upload has ended. |
EventCallback<FileEndedEventArgs> |
FocusIn |
Notifies when the input box gains focus. |
EventCallback<FocusEventArgs> |
FocusOut |
Notifies when the input box loses focus. |
EventCallback<FocusEventArgs> |
KeyDown |
Notifies when a key is pressed down while the control has focus. |
EventCallback<KeyboardEventArgs> |
KeyPress |
Notifies when a key is pressed while the control has focus. |
EventCallback<KeyboardEventArgs> |
KeyUp |
Notifies when a key is released while the control has focus. |
EventCallback<KeyboardEventArgs> |
OnFocus |
Notifies when the input box gains or loses focus. |
EventCallback<FocusEventArgs> |
Progressed |
Notifies the progress of file being written to the destination stream. |
EventCallback<FileProgressedEventArgs> |
Started |
Notifies when an individual file upload has started. |
EventCallback<FileStartedEventArgs> |
ValueChanged |
Occurs after value has changed. |
EventCallback<TValue> |
Written |
Occurs every time the part of file has being written to the destination stream. |
EventCallback<FileWrittenEventArgs> |
Methods
| Method | Description | Return | Parameters |
|---|---|---|---|
NotifyChange |
Notifies the component that file input value has changed. | Task | FileEntry[] files |
OpenReadStream |
Opens the stream for reading the uploaded file. | Stream | IFileEntry fileEntry, CancellationToken cancellationToken |
RemoveFileEntry |
Removes the file entry from js dictionary. | Task | IFileEntry fileEntry, CancellationToken cancellationToken |
RemoveFile |
Removes a file from the current file selection. | ValueTask | int fileId |
Reset |
Manually resets the input file value. | ValueTask | |
ShowPicker |
Show a browser picker for the file input. | Task | |
UpdateFileEndedAsync |
Notifies the component that file upload has ended. | Task | IFileEntry fileEntry, bool success, FileInvalidReason fileInvalidReason |
UpdateFileProgressAsync |
Updated the component with the latest upload progress. | Task | IFileEntry fileEntry, long progressProgress |
UpdateFileStartedAsync |
Notifies the component that file upload is about to start. | Task | IFileEntry fileEntry |
UpdateFileWrittenAsync |
Updates component with the latest file data. | Task | IFileEntry fileEntry, long position, byte[] data |
WriteToStreamAsync |
Writes the file data to the target stream. | Task | IFileEntry fileEntry, Stream stream, CancellationToken cancellationToken |
Focus |
Sets the focus on the underline element. | Task | bool scrollToElement |
Revalidate |
Forces the Validation (if any is used) to re-validate with the new custom or internal value. | Task |