View difference between Paste ID: 517GX9yk and UnKQwUWt
SHOW: | | - or go back to the newest paste.
1-
public static class Utils
1+
public static class Utils
2-
{
2+
{
3-
    public static string GetExtension(this IFormFile file)
3+
    public static string GetExtension(this IFormFile file)
4-
    {
4+
    {
5-
        return Path.GetExtension(file.FileName);
5+
        return Path.GetExtension(file.FileName);
6-
    }
6+
    }
7-
    public static byte[] ToByteArray(this IFormFile file)
7+
    public static byte[] ToByteArray(this IFormFile file)
8-
    {           
8+
    {           
9-
        using (BinaryReader reader = new BinaryReader(file.OpenReadStream()))
9+
        using (BinaryReader reader = new BinaryReader(file.OpenReadStream()))
10-
        {
10+
        {
11-
            return reader.ReadBytes((int)file.Length);
11+
            return reader.ReadBytes((int)file.Length);
12-
        }                
12+
        }                
13-
    }
13+
    }
14
}