Skip to content

Commit 2174b8b

Browse files
[Docs] Update InputFile docs to explain usage of different InputFileModes (#3757)
* Update docs to explain use cases of different InputFileModes * Use MiB and KiB instead of MB and KB
1 parent 54f2645 commit 2174b8b

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5273,6 +5273,7 @@
52735273
Gets or sets the type of file reading.
52745274
For SaveToTemporaryFolder, use <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFileEventArgs.LocalFile" /> to retrieve the file.
52755275
For Buffer, use <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFileEventArgs.Buffer" /> to retrieve bytes.
5276+
For Stream, use <see cref="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFileEventArgs.Stream"/> to have full control over retrieving the file.
52765277
</summary>
52775278
</member>
52785279
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentInputFile.DragDropZoneVisible">
@@ -8299,6 +8300,11 @@
82998300
Gets or sets the Menu status.
83008301
</summary>
83018302
</member>
8303+
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentProfileMenu.OpenChanged">
8304+
<summary>
8305+
Gets or sets the callback that is invoked when the open state changes.
8306+
</summary>
8307+
</member>
83028308
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentProfileMenu.TopCorner">
83038309
<summary>
83048310
Gets or sets whether popover should be forced to top right or top left (RTL).
@@ -8416,6 +8422,9 @@
84168422
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentProfileMenu.PersonaId">
84178423
<summary />
84188424
</member>
8425+
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentProfileMenu.OpenChangedHandlerAsync">
8426+
<summary />
8427+
</member>
84198428
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentProgress.Min">
84208429
<summary>
84218430
Gets or sets the minimum value.

examples/Demo/Shared/Pages/InputFile/InputFilePage.razor

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
<div>
2424
<DemoSection Title="Default" Component="@typeof(InputFileDefault)">
2525
<Description>
26+
<p>By default this component will use the <code>SaveToTemporaryFolder</code> mode which creates a local file.</p>
27+
28+
<FluentMessageBar Title="Warning:" Intent="@MessageIntent.Warning" AllowDismiss="false" FadeIn="false">
29+
This might not always be possible depending on the user rights on the host. You may need to change the <code>InputFileMode</code> depending on your use case.
30+
</FluentMessageBar>
2631

2732
</Description>
2833
</DemoSection>
@@ -41,13 +46,22 @@
4146

4247
<DemoSection Title="Mode = InputFileMode.Buffer" Component="@typeof(InputFileBufferMode)">
4348
<Description>
49+
<p>Using the <code>Buffer</code> mode will load the entire file into memory during uploading.</p>
50+
51+
<p>This mode is recommended when you cannot store local files and you are working small files and have enough memory.</p>
4452

4553
</Description>
4654
</DemoSection>
4755

4856
<DemoSection Title="Mode = InputFileMode.Stream" Component="@typeof(InputFileStream)">
4957
<Description>
58+
<p>The <code>Stream</code> mode gives you more control of the uploading process to save memory. In order for it to work you will need to implement the handling for the stream on your own.</p>
59+
60+
<p>This mode is recommended when you want to upload large files which you do not want to hold entirely in memory.</p>
5061

62+
<FluentMessageBar Title="Warning:" Intent="@MessageIntent.Warning" AllowDismiss="false" FadeIn="false">
63+
Remember to always dispose each stream to prevent memory leaks!
64+
</FluentMessageBar>
5165
</Description>
5266
</DemoSection>
5367

src/Core/Components/InputFile/FluentInputFile.razor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public FluentInputFile()
6666

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

7474
/// <summary>
7575
/// Gets or sets the sze of buffer to read bytes from uploaded file (in bytes).
76-
/// Default value is 10 KB.
76+
/// Default value is 10 KiB.
7777
/// </summary>
7878
[Parameter]
7979
public uint BufferSize { get; set; } = 10 * 1024;
@@ -97,6 +97,7 @@ public FluentInputFile()
9797
/// Gets or sets the type of file reading.
9898
/// For SaveToTemporaryFolder, use <see cref="FluentInputFileEventArgs.LocalFile" /> to retrieve the file.
9999
/// For Buffer, use <see cref="FluentInputFileEventArgs.Buffer" /> to retrieve bytes.
100+
/// For Stream, use <see cref="FluentInputFileEventArgs.Stream"/> to have full control over retrieving the file.
100101
/// </summary>
101102
[Parameter]
102103
public InputFileMode Mode { get; set; } = InputFileMode.SaveToTemporaryFolder;

0 commit comments

Comments
 (0)