Fix broken Blazor file upload component (#22582)

pull/22583/head
Luke Latham 2021-06-21 08:37:10 -05:00 committed by GitHub
parent a7f992a209
commit 21e12d47bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -65,7 +65,7 @@
if (uploadResults.SingleOrDefault(
f => f.FileName == file.Name) is null)
{
using var fileContent = new StreamContent(file.OpenReadStream());
var fileContent = new StreamContent(file.OpenReadStream());
files.Add(
new()

View File

@ -30,7 +30,7 @@ Web API controllers don't have to check `ModelState.IsValid` if they have the `[
## Rerun validation
Validation is automatic, but you might want to repeat it manually. For example, you might compute a value for a property and want to rerun validation after setting the property to the computed value. To rerun validation, call [`ModelState.ClearValidationState`](Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary.ClearValidationState) to clear validation specific to the model being validated followed by `TryValidateModel`:
Validation is automatic, but you might want to repeat it manually. For example, you might compute a value for a property and want to rerun validation after setting the property to the computed value. To rerun validation, call <xref:Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary.ClearValidationState%2A?displayProperty=nameWithType> to clear validation specific to the model being validated followed by `TryValidateModel`:
[!code-csharp[](validation/samples/3.x/ValidationSample/Pages/Movies/Create.cshtml.cs?name=snippet_TryValidate&highlight=6-10)]