View FileAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileAttribute : ValidationAttribute | |
{ | |
public string[] FileTypes { get; set; } | |
protected override ValidationResult IsValid(object value, ValidationContext validationContext) | |
{ | |
if (value is IFormFile) | |
{ | |
return ValidateSingleFile((IFormFile)value); | |
} | |
else if (value is IEnumerable<IFormFile>) |
View FileAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Web; | |
namespace TestProjectMVC5.Models | |
{ | |
public class FileAttribute : ValidationAttribute | |
{ |