Soenneker.Extensions.IFormFile 11.0.838

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Extensions.IFormFile --version 11.0.838
                    
NuGet\Install-Package Soenneker.Extensions.IFormFile -Version 11.0.838
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Extensions.IFormFile" Version="11.0.838" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.IFormFile" Version="11.0.838" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.IFormFile" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Extensions.IFormFile --version 11.0.838
                    
#r "nuget: Soenneker.Extensions.IFormFile, 11.0.838"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Extensions.IFormFile@11.0.838
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Extensions.IFormFile&version=11.0.838
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.IFormFile&version=11.0.838
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.IFormFile

Copies an ASP.NET Core IFormFile into an independently owned MemoryStream positioned for reading.

Installation

dotnet add package Soenneker.Extensions.IFormFile

Buffer an upload

using Soenneker.Extensions.IFormFile;

const long maxUploadBytes = 10 * 1024 * 1024;

if (formFile.Length > maxUploadBytes)
    return Results.BadRequest("The file is too large");

await using MemoryStream stream = await formFile.ToMemoryStream(cancellationToken);
await ProcessUpload(stream, cancellationToken);

Both overloads copy the entire file and reset the returned stream to position zero. They do not impose a size limit, validate the declared content type, scan the content, or sanitize IFormFile.FileName. Enforce those policies before buffering or persisting an untrusted upload.

The default overload pre-sizes a normal MemoryStream when the declared file length fits in an int:

await using MemoryStream stream = await formFile.ToMemoryStream(cancellationToken);

Use the utility overload when a scoped recyclable-stream utility is already available:

await using MemoryStream stream =
    await formFile.ToMemoryStream(memoryStreamUtil, cancellationToken);

The utility-provided stream is cleared before copying, so bytes from an earlier use are not retained in the result.

The caller owns the returned stream and must dispose it. If copying fails or is cancelled, the extension disposes the stream before propagating the failure. The input file and utility must be non-null.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.839 29 10/27/2026
11.0.838 59 10/26/2026
11.0.837 61 10/26/2026
11.0.836 58 10/26/2026
11.0.834 55 10/26/2026
11.0.833 57 10/26/2026
11.0.832 60 10/26/2026
4.0.831 115 10/15/2026
4.0.830 88 10/15/2026
4.0.829 89 10/14/2026
4.0.828 76 10/14/2026
4.0.827 82 10/14/2026
4.0.826 88 10/14/2026
4.0.824 88 10/14/2026
4.0.817 92 10/13/2026
4.0.816 91 10/12/2026
4.0.814 84 10/12/2026
4.0.813 95 10/11/2026
4.0.811 102 10/11/2026
4.0.810 162 9/30/2026
Loading failed

Updated Multiple NuGet packages