Blazor webassembly get file access

Christian Steinmetz 0 Reputation points

How can I access local file system with blazor webassembly?

Sorry that was a try using AI. But it was not functional :-(

A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
989 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce ( 36,421 Reputation points

    to access the file system in a web assembly, you use js interop and call the file api.

    the main restriction is the code can only open a file with the <input type="file"> control, not by name. that is the use must select the file.

    you use the FileReader to read a selected file:

    the other restriction is passing js binary (blob) data to blazor code. you will need to convert the blob to base64 (readAsDataUrl).

    0 comments No comments