diff --git a/README.md b/README.md index 8495067..a26c500 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,36 @@ This is a prototype for a file input component that may be added to Blazor in the future. For installation and usage information, see [this blog post](http://blog.stevensanderson.com/2019/09/13/blazor-inputfile/). + +## Using a custom button with MatBlazor: + +```csharp + + + +@if (file != null) +{ +

Name: @file.Name

+

Size in bytes: @file.Size

+

Last modified date: @file.LastModified.ToShortDateString()

+

Content type (not always supplied by the browser): @file.Type

+} + +@code { + + public async void OnButtonClick(string elementID) + { + await JSRuntime.InvokeAsync("BlazorInputFile.wrapInput", elementID); + } + + IFileListEntry file; + + void HandleFileSelected(IFileListEntry[] files) + { + file = files.FirstOrDefault(); + } + +} +``` + +Reference from [here](https://stackoverflow.com/a/9546968)