max number of files rule ignored when working with non images file uploads
Closed this issue · 0 comments
Including the MVCFileUploader in a new project that allows the following file types to be uploaded:
word, excel, pdf, images.
We have set a max file number of 10 files in anyone upload. This works fine when just using images, i.e. try and upload 11 images and the 11th will display a validation error in the template table.
However if you use pdf, for example you can upload as many files, in one go as you like, and no validation message is displayed. Here is how I have set-up the html helper:
Html.MvcFileUpload()
.UploadAt(Url.Action("UploadFile"))
.UIStyle(ui)
.MaxNumberOfFiles(maxFilesThatCanBeUploaded)
.WithFileTypes(@"/(.|/)(jpe?g|png|gif|doc|docx|docm|xls|xlsx|xlsm|csv|ppt|pptx|pdf|rtf|txt)$/i")
.WithMaxFileSize(5000000)
.AddFormField("entityId", "1234")
.AddFormField("Strip", "")
.AddFormField("User", currentUser)
.RenderInline("_MvcFileupload")