这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
648 B

using System;
using System.Collections.Generic;
using System.Linq;
namespace System;
public static class ByteExtensions
{
private readonly static string[] ImageTypes = new string[]
{
"6677",// bmp
"7173",// gif
"13780",// png
"255216"// jpg
};
public static bool IsImage(this byte[] fileBytes)
{
if (fileBytes.IsNullOrEmpty())
{
return false;
}
string fileclass = "";
for (int i = 0; i < 2; i++)
{
fileclass += fileBytes[i].ToString();
}
return ImageTypes.Any(type => type.Equals(fileclass));
}
}