Update 12/08/2017, the Github issue has now been updated with the question below, see comment from ardalis: 3691
I am trying to get a stream of files running in .NET Core MVC using information from Microsoft Sample; Fileuploadload
But without success in a clean .Net Core MVC (since the example uses Angular bindings for streaming, which I don't use).
This Test File Streaming Repo contains the minimum code to reproduce the problem I received.
The user goes to TestFileUpload / Views / Streaming / Index.cshtml, he enters some details and selects the file to upload. Then the user will submit the form;
<form asp-area="" enctype="multipart/form-data" asp-controller="Streaming" asp-action="StreamUpload" asp-route-returnurl="@ViewData[ "ReturnUrl" ]" id="submit-file-form" method="post"> <input name="CurriculumVitae" type="file" id="file" /> <button type="submit">Create User</button> </form>
The form then calls inside: TestFileUpload / Controllers / StreamingController.cs
public async Task< IActionResult > StreamUpload() { ... var reader = new MultipartReader( boundary, HttpContext.Request.Body ); var section = await reader.ReadNextSectionAsync(); ... }
But then I get the error message "IOException: Unexpected end of stream, content may have already been read by another component."
TestFileUpload.Controllers.StreamingController+<StreamUpload>d__2.MoveNext() in StreamingController.cs 51. var section = await reader.ReadNextSectionAsync();
source share