Here is my code
getting the file from FileSelectFileInfo
public FileSelectFileInfo selectedFile { get; set; }
then if there is a selected file, i store it in the variable above
private async Task OnSelectHandler(FileSelectEventArgs args){ selectedFile = args.Files[0];}
this triggers an API endpoint to be executed
private async Task OnSubmit(){ try { if (selectedFile != null) { using (var memoryStream = new MemoryStream()) { await selectedFile.Stream.CopyToAsync(memoryStream); memoryStream.Position = 0; } } else { Console.WriteLine("File is empty"); } } catch (Exception ex) { Console.WriteLine(ex.Message); }}
I'm expecting to pass it to an API endpoint that`s accepting a Stream