Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.
Open
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
3 changes: 2 additions & 1 deletion BlazorInputFile/InputFile.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
@implements IDisposable
@inject IJSRuntime JSRuntime

<input type="file" @ref="inputFileElement" @attributes="UnmatchedParameters" />
<input type="file" @ref="inputFileElement" @attributes="UnmatchedParameters" accept="@FileFormatFilter" />

@code {
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> UnmatchedParameters { get; set; }
[Parameter] public EventCallback<IFileListEntry[]> OnChange { get; set; }
[Parameter] public int MaxMessageSize { get; set; } = 20 * 1024; // TODO: Use SignalR default
[Parameter] public int MaxBufferSize { get; set; } = 1024 * 1024;
[Parameter] public string FileFormatFilter { get; set; }

ElementReference inputFileElement;
IDisposable thisReference;
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample.Core/Pages/ImageFile.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p>A single file input that reads the input as an image in a chosen format with specified maximum dimensions.</p>

<InputFile OnChange="HandleSelection" />
<InputFile OnChange="HandleSelection" FileFormatFilter="image/*" />

<p>@status</p>

Expand Down