Check out example codes for "validating file upload asp.net core mvc". It will help you in understanding the concepts better.

Code Example 1

public class UserViewModel
{
        [Required(ErrorMessage = "Please select a file.")]
        [DataType(DataType.Upload)]
        [MaxFileSize(5* 1024 * 1024)]
        [AllowedExtensions(new string[] { ".jpg", ".png" })]
        public IFormFile Photo { get; set; }
 }

Learn ReactJs, React Native from akashmittal.com