Skip to content

[Docs] [dev-v5] Adapt changes to InputFile docs (#3764) #3768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025
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 @@ -19,6 +19,8 @@ The component can be customized by adapting the `ChildContent`.
The areas that need to be associated with the opening of the file selection dialog
must be included in a `label for` that references the component `Id`: E.g. `<label for=“my-file-uploader”>browse...</label>`.

> ℹ️ By default, this component uses the `SaveToTemporaryFolder` mode, which creates a local file. However, this might not always be possible depending on the user's permissions on the host system. You may need to change the `InputFileMode` based on your specific use case.

{{ InputFileDefault }}

## Manual upload
Expand All @@ -34,12 +36,16 @@ By default, the component has a parameter `Mode=“InputFileMode.SaveToTemporary
Change this parameter to `InputFileMode.Buffer` to control the reception of files directly into memory.
When the `OnCompleted` event is triggered, the entire file content is present in the `file.Buffer` property.

This mode is recommended if you can't store files locally, are working with small files, and have enough memory.

{{ InputFileBufferMode }}

## Mode = InputFileMode.Stream

If you want to transfer very large files and do not want to save your files locally (in a temporary folder, for example),
you can retrieve the file stream from the `OnFileUploaded` event and the `file.Stream` property.
you can retrieve the file stream from the `OnFileUploaded` event and the `file.Stream` property. Keep in mind that you will need to implement stream handling yourself.

> ⚠️ Remember to always dispose each stream to prevent memory leaks!

{{ InputFileStream }}

Expand Down
5 changes: 3 additions & 2 deletions src/Core/Components/InputFile/FluentInputFile.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ public FluentInputFile()

/// <summary>
/// Gets or sets the maximum size of a file to be uploaded (in bytes).
/// Default value is 10 MB.
/// Default value is 10 MiB.
/// </summary>
[Parameter]
public long MaximumFileSize { get; set; } = 10 * 1024 * 1024;

/// <summary>
/// Gets or sets the sze of buffer to read bytes from uploaded file (in bytes).
/// Default value is 10 KB.
/// Default value is 10 KiB.
/// </summary>
[Parameter]
public uint BufferSize { get; set; } = 10 * 1024;
Expand All @@ -106,6 +106,7 @@ public FluentInputFile()
/// Gets or sets the type of file reading.
/// For SaveToTemporaryFolder, use <see cref="FluentInputFileEventArgs.LocalFile" /> to retrieve the file.
/// For Buffer, use <see cref="FluentInputFileEventArgs.Buffer" /> to retrieve bytes.
/// For Stream, use <see cref="FluentInputFileEventArgs.Stream"/> to have full control over retrieving the file.
/// </summary>
[Parameter]
public InputFileMode Mode { get; set; } = InputFileMode.SaveToTemporaryFolder;
Expand Down
Loading