dotnet / dotnet/aspnetcore

Basic IFormFile model validation attributes

Open
#47,809 1 comment 0 reactions 0 assignees View on GitHub
area-mvc enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

_No response_

### Describe the solution you'd like

It would be nice to have a model validation attribute like `MaxFileSizeAttribute` on `IFormFile` fields to validate the file size.

It might also be nice to have a `FileExtensionsAttribute` (like the one in System.ComponentModel.DataAnnotations) that works on IFormFile types by looking at the file name. Although this would not suffice as proper validation, it could serve as basic validation before checking the actual file content.

### Additional context

Related to #8573

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.