Blazorise File Input API

Explore the Blazorise File Input API reference for parameters, events, methods, and related types.

For examples and usage guidance, see the File Input documentation.

API

Parameters

Parameter Description TypeDefault
AriaDescribedBy

Specifies the aria-describedby attribute value.

Remarks

When 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.

Remarks

When set, this value is rendered as-is and overrides the validation-derived aria-invalid state.

string
AriaLabelledBy

Specifies the aria-labelledby attribute value.

Remarks

When 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.

Remarks

When set, this value overrides the required-field state resolved from the parent Validation.

boolfalse
Autofocus

Set's the focus to the component after the rendering is done.

boolfalse
AutoReset

If true file input will be automatically reset after it has being uploaded.

booltrue
BrowseButtonLocalizer

Function used to handle custom localization that will override a default ITextLocalizer.

TextLocalizerHandlernull
ChildContent

Specifies the content to be rendered inside this FileInput.

RenderFragmentnull
Directory

Determines whether file picker should upload directories.

boolfalse
Disabled

Add the disabled boolean attribute on an input to prevent user interactions and make it appear lighter.

boolfalse
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.

boolfalse
Feedback

Placeholder for validation messages.

RenderFragmentnull
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.

Remarks

See docs.microsoft.com.

int20 * 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.

longlong.MaxValue
Multiple

Enables the multiple file selection.

boolfalse
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.

boolfalse
SegmentFetchTimeout

Specifies the Segment Fetch Timeout when uploading the file.

TimeSpanTimeSpan.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.

TValuenull
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.

Remarks

Should 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 DescriptionReturnParameters
NotifyChange Notifies the component that file input value has changed. TaskFileEntry[] files
OpenReadStream Opens the stream for reading the uploaded file. StreamIFileEntry fileEntry, CancellationToken cancellationToken
RemoveFileEntry Removes the file entry from js dictionary. TaskIFileEntry fileEntry, CancellationToken cancellationToken
RemoveFile Removes a file from the current file selection. ValueTaskint 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. TaskIFileEntry fileEntry, bool success, FileInvalidReason fileInvalidReason
UpdateFileProgressAsync Updated the component with the latest upload progress. TaskIFileEntry fileEntry, long progressProgress
UpdateFileStartedAsync Notifies the component that file upload is about to start. TaskIFileEntry fileEntry
UpdateFileWrittenAsync Updates component with the latest file data. TaskIFileEntry fileEntry, long position, byte[] data
WriteToStreamAsync Writes the file data to the target stream. TaskIFileEntry fileEntry, Stream stream, CancellationToken cancellationToken
Focus Sets the focus on the underline element. Taskbool scrollToElement
Revalidate Forces the Validation (if any is used) to re-validate with the new custom or internal value. Task
On this page