locked
VS Compiler does not recognize <InputFile> and InputFileChangeEventArgs in Server-side Blazor RRS feed

  • Question

  • User-1996846836 posted

    I am following this guide to make an upload file component, but the compiler does not recognize the InputFile component.
    If I add @onchange to the markup element the compiler recognizes the component, but I still cannot use InputFileChangeEventArgs in the onchange method, which renders the element useless since I cant access the file that was uploaded. Same thing when using <input type="file"/>

    I have "Microsoft.AspNetCore.Components.Forms" included in my _Imports.cshtml and other components from this library work fine.
    I am guessing that the assembly reference is wrong but I don't know how to check or fix it.
    I tried installing the "Microsoft.AspNetCore.Components.Forms v5.0.1" NuGet package hoping that it will fix all required references, but I get an error that it is not compatible with netcoreapp3.1, which is what I am using.

    Any info or useful links will be much appreciated. Thanks!
    Sorry if this is not the right place to ask such questions, its my first time here. If you know any better place to post this feel free  to share it :)

    Tuesday, January 5, 2021 10:04 AM

Answers

  • User-474980206 posted

    You need to upgrade to .net 5 to get builtin  file support in blazor.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 5, 2021 3:55 PM