Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

validating file upload asp.net core mvc

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; }
 }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #validating #file #upload #core #mvc
ADD COMMENT
Topic
Name
1+2 =