Skip to content

zaminalili/Validation.Attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validation.Attributes

NuGet Version License

Lightweight custom validation attributes for .NET projects.

How to use

dotnet add package Zed.Validation.Attributes

Usage example

public class UploadFileDto
{
    [AllowedExtensions([".jpg", ".png"], ErrorMessage = "Only JPG or PNG files are allowed.")]
    [MaxFileSize(5 * 1024 * 1024, ErrorMessage = "File size must not exceed 5MB.")]
    public IFormFile File { get; set; }
}

Available Attributes

  • AllowedExtensions – Restricts uploaded file types based on extensions
  • MaxFileSize – Limits the maximum size of uploaded files

About

Input validation attributes

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages