From d8e1d83abb5768529ff045942aa33c157c2d1c83 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Tue, 13 Sep 2022 16:38:37 -1000 Subject: [PATCH 1/2] IForm uploads /1 --- aspnetcore/fundamentals/minimal-apis.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aspnetcore/fundamentals/minimal-apis.md b/aspnetcore/fundamentals/minimal-apis.md index d585d5f7cb16..bd9ab32160f3 100644 --- a/aspnetcore/fundamentals/minimal-apis.md +++ b/aspnetcore/fundamentals/minimal-apis.md @@ -1133,6 +1133,16 @@ Using a `struct` with `AsParameters` can be more performant than using a `record The [complete sample code](https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/fundamentals/minimal-apis/samples/arg-lists) in the [AspNetCore.Docs.Samples](https://github.com/dotnet/AspNetCore.Docs.Samples) repository. +## File uploads using IFormFile and IFormFileCollection + +The following code uses and to upload file: + +:::code language="csharp" source="~/fundamentals/minimal-apis/iformFile/7.0-samples/MinimalApi/Program.cs" ::: + +Authenticated file upload requests are supported using an [Authorization header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Authorization), a [client certificate](/aspnet/core/security/authentication/certauth), or a cookie header. + +There is no built-in support for [antiforgery](/aspnet/core/security/anti-request-forgery?view=aspnetcore-7.0&preserve-view=true#anti7). However, it can be implemented using the [`IAntiforgery` service](/aspnet/core/security/anti-request-forgery?view=aspnetcore-7.0&preserve-view=true#antimin7). + ## Request handling The following sections cover routing, parameter binding, and responses. From dfc911d88477fcfa121540ad2936dcf2d309f227 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Tue, 13 Sep 2022 16:45:03 -1000 Subject: [PATCH 2/2] IForm uploads /1 --- aspnetcore/release-notes/aspnetcore-7.0.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index 1ba7fe40ae22..8335e4178835 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -152,6 +152,16 @@ In the following sample, the `/skipme` endpoint is excluded from generating an O [!code-csharp[](~/fundamentals/minimal-apis/7.0-samples/WebMinAPIs/Program.cs?name=snippet_swag2&highlight=20-21)] +### File uploads using IFormFile and IFormFileCollection + +Minimal APIs now support file upload with `IFormFile` and `IFormFileCollection`. The following code uses and to upload file: + +:::code language="csharp" source="~/fundamentals/minimal-apis/iformFile/7.0-samples/MinimalApi/Program.cs" ::: + +Authenticated file upload requests are supported using an [Authorization header](https://developer.mozilla.org/docs/Web/HTTP/Headers/Authorization), a [client certificate](/aspnet/core/security/authentication/certauth), or a cookie header. + +There is no built-in support for [antiforgery](/aspnet/core/security/anti-request-forgery?view=aspnetcore-7.0&preserve-view=true#anti7). However, it can be implemented using the [`IAntiforgery` service](/aspnet/core/security/anti-request-forgery?view=aspnetcore-7.0&preserve-view=true#antimin7). + ## Minimal APIs and API controllers The [`[AsParameters]` Attribute](xref:Microsoft.AspNetCore.Http.AsParametersAttribute) enables parameter binding for argument lists . For more information, see [Parameter binding for argument lists with `[AsParameters]`](xref:fundamentals/minimal-apis?view=aspnetcore-7.0&preserve-view=true#asparam7).