using System.IO;
using Microsoft.AspNetCore.Http;
namespace xCommons.Extensions {
public static partial class XHttpContextExtensions {
///
/// Convert IFormFile to Bytes Array
///
///
///
public static byte[] ToByteArray (this IFormFile source) {
//
byte[] data;
using (var br = new BinaryReader (source.OpenReadStream ())) {
data = br.ReadBytes ((int) source.OpenReadStream ().Length);
}
//
return data;
}
}
}