asp.net core 检测上传文件为图片格式

浪淘沙2年前后端300
  #region 检测图片格式
  var validMimeTypes = new[] { "image/jpeg", "image/png", "image/gif" };
  if (!validMimeTypes.Contains(upload.ContentType.ToLowerInvariant()))
  {
      return "{\"uploaded\": 0,\"error\": {\"message\": \"请上传图片格式\"}}";
  }
  #endregion


相关文章

asp.net core SqlSugar对SugarParameter 参数的调试

string sql = "select id,xm from stu where phone=@phone&...

JNTemplate 模板标签传递url参数

一、模板 private readonly SqlSugar.ISqlSugarClient _db;  public Index1M...

asp.net core [BindProperty] 用法

在 ASP.NET Core 中,[BindProperty] 是一种用于绑定模型属性的特性,通常与 Razor 页面配合使用。它会自动将请求中的表单数据绑定到页面模型的属性上,简化了手动从 Requ...

asp.net core json解析

一、json{   "cover": {     "title": &quo...

asp.net core razor 读取form中,同一name的值 分解

asp.net core razor 读取form中,同一name的值 分解

@page @model xxtsoft.Web.Entry.Pages.sysadmins.mb.mbModel @{     Layout&...

asp.net core MiniExcelLibs 导出excel

public IActionResult OnPostDown() {        DataTable ...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。