Sujeet Raman

Sujeet Raman

  • 864
  • 927
  • 352.9k

How to validate MIME type of multiple selected file in c#

Jan 18 2023 6:14 AM

following code i am able to validate when i select a single image.But how can i change this validation when i want to upload multiple images

 [Required]
   public BrowsedFile FileToUpload { get; set; }
  
//how i can change below code when i have list of files
       [Required(ErrorMessage = "files should be mime types")]
        public string FileContentType =>ContentTypes.TryConvertFromFileExtension(FileToUpload?.FileExtension, FileToUpload?.File.ContentType ?? string.Empty);

following list i will be using for multiple image store


        
        [Required]
        public IReadOnlyList<BrowserFile>? ListFiles{get;set:)
       

 


Answers (3)