Skip to content

Instantly share code, notes, and snippets.

@jonhilt
Created November 6, 2024 09:37
Show Gist options
  • Save jonhilt/8b50b1e38dbe613fe956a49cbdbb44e0 to your computer and use it in GitHub Desktop.
Save jonhilt/8b50b1e38dbe613fe956a49cbdbb44e0 to your computer and use it in GitHub Desktop.
@page "/Testing"
<label class="fileInputZone" for="inputFile" title="Upload files">
Upload
</label>
<InputFile id="inputFile" OnChange="LoadFiles" multiple accept="@(String.Join(','))"/>
@foreach (var uploadInfo in _queuedFileUploads)
{
<div style="">
<span>@uploadInfo.Name</span>
<Button SelectedButtonType="ButtonType.Square" IconName="Icon.IconCross" Click="() => CancelUpload(uploadInfo)"></Button>
</div>
}
@code {
private readonly List<IBrowserFile> _queuedFileUploads = [];
private void LoadFiles(InputFileChangeEventArgs obj)
{
Console.WriteLine("Uploading file");
_queuedFileUploads.Add(obj.File);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment