Skip to content

Commit ec629ec

Browse files
Copilotwadepickett
andauthored
Add IFormFile binding information to minimal APIs documentation (#36171)
* Initial plan * Add IFormFile binding information to minimal APIs documentation Co-authored-by: wadepickett <[email protected]> * Apply suggestion from @wadepickett * Revert changes to parameter-binding7, 8, and 9 files Co-authored-by: wadepickett <[email protected]> * Rename parameter-binding10.md to parameter-binding8-10.md to match main branch Co-authored-by: wadepickett <[email protected]> * Apply suggestion from @wadepickett Added links for binding to entire request body per review. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: wadepickett <[email protected]> Co-authored-by: Wade Pickett <[email protected]>
1 parent 26135f7 commit ec629ec

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

aspnetcore/fundamentals/minimal-apis/includes/parameter-binding8-10.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ The following code shows the complete `Program.cs` file:
186186

187187
### File uploads using IFormFile and IFormFileCollection
188188

189+
File uploads using `IFormFile` and `IFormFileCollection` in minimal APIs require `multipart/form-data` encoding. The parameter name in the route handler must match the form field name in the request. Minimal APIs don't support binding the entire request body directly to an `IFormFile` parameter without form encoding.
190+
191+
If you need to bind the entire request body, for example, when working with JSON, binary data, or other content types, see:
192+
193+
- [Bind the request body as a Stream or PipeReader](#bind-the-request-body-as-a-stream-or-pipereader)
194+
- [Explicit Parameter Binding](#explicit-parameter-binding)
195+
189196
The following code uses <xref:Microsoft.AspNetCore.Http.IFormFile> and <xref:Microsoft.AspNetCore.Http.IFormFileCollection> to upload file:
190197

191198
:::code language="csharp" source="~/fundamentals/minimal-apis/iformFile/7.0-samples/MinimalApi/Program.cs" :::

0 commit comments

Comments
 (0)