@page "/fileup"
<h3>FileUp</h3>
<InputFile OnChange="@UploadedExcel" accept=".xlsx" />
@code {
public async Task UploadedExcel(InputFileChangeEventArgs e)
{
Console.WriteLine("Hello");
}
}
The code should be basic enough but it doesn't trigger the task down below when I upload a file. Am I missing something?
I have tried a few different things including changing to multifile and all. I have another page with full code block that I don't wanna sahre because of many unrelated things. But this on itself should work right? Network
I was missing the @rendermode InteractiveAuto at the top of the page. After adding it, it triggered my method.
In my case the file upload fired the event after adding this code to the top of the page
@rendermode InteractiveServer
this option means you use Interactive server-side rendering (interactive SSR) with the razor page. I am using .net 8 which uses static server-side rendering by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With