S
S
Saharman2019-10-14 15:12:35
ASP.NET
Saharman, 2019-10-14 15:12:35

How to get IFormFile from input[type=file] in Blazor?

I am writing an application on the Blazor Server Side. There is a task to get IFormFile from input.
There is this code:

<input type="file" class="form-control" id="file" @bind-value="file" placeholder="Выберите файл" />
....
...
....
@code {
    IFormFile file;
}

I am getting this error:
System.InvalidOperationException: "The type 'Microsoft.AspNetCore.Http.IFormFile' does not have an associated TypeConverter that supports conversion from a string. Apply 'TypeConverterAttribute' to the type to register a converter."

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question