The non-public.member _baseStream attribute in IFormFile in my ASP.NET Core application throws the following exception after uploading a file:
ReadTimeout = ((Microsoft.AspNetCore.Http.Internal.FormFile)BildUpload)._baseStream.ReadTimeout' threw an exception of type 'System.InvalidOperationException'
I'm trying to upload a file using a razor page with the following code:
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="BildUpload" />
</div>
<input type="submit" value="Upload" class="btn btn-default" />
</form>
In the codebehind class I only got the declaration and nothing else read or writes the paramter excepts the razor page:
public IFormFile BildUpload { get; set; }
Thanks for your help!
My final goal is to parse the file to a byte array and sava at to a database like this: How to Convert a file into byte array directly without its path(Without saving file) But over there I'm getting a nullpointer exception.