ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,503 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi
How to convert iFormFile to Byte array?, I have tried the below, but it keeps give me Cannot access a disposed object. Object name: 'FileBufferingReadStream
foreach (var formFile in supportingFiles)
{
long fileSize = formFile.Length;
string fileType = formFile.ContentType;
if (fileSize > 0)
{
using (var stream = new MemoryStream())
{
formFile.CopyTo(stream);
var bytes = stream.ToArray();
// do some stuffs
}
}