dotnet / dotnet/AspNetCore.Docs
Streaming example is not streaming
- Dominant language
- C#
- Stars
- 13.1k
- Forks
- 24.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 97
Description
This example specifically talks about how streaming reduces the demands for memory or disk space when uploading large files.
The section [Upload large files with streaming](https://learn.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-7.0#upload-large-files-with-streaming) shows code calling [FileHelpers.ProcessStreamedFile](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/models/file-uploads/samples/3.x/SampleApp/Utilities/FileHelpers.cs#L149). That code creates a MemoryStream and copies the entire source stream into it. At the end it creates another copy of the stream by calling ToArray().
Maybe I did not understand the purpose of this example but it seems to do the exact opposite of what the article tries to communicate and I therefore highly recommend that this (part of the) article is corrected or removed.
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: 9a5cfa38-0e6c-4346-dafc-84ea5c513fcf
* Version Independent ID: c6787f0f-3e9a-6efb-0e6e-5ccb957d3f4a
* Content: [Upload files in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/mvc/models/file-uploads?view=aspnetcore-7.0#upload-large-files-with-streaming)
* Content Source: [aspnetcore/mvc/models/file-uploads.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/models/file-uploads.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-mvc**
* GitHub Login: @Rick-Anderson
* Microsoft Alias: **riande**
Contributor guide
Assessment
This issue has not been assessed yet.