Limit number of files for Multi file select

pat01 07 Feb, 2020
Hello

I use an upload field for uploading JPG files. I have enabled "Multi file select".

Is there a way to limit the number of files for upload?
I want the user to select 15 files maximum.

Thanks.

Patrick
healyhatman 07 Feb, 2020
Use a validate data action
fileUploadFieldNameGoesHere/maxCount[15]:You have selected too many files!
Something similar in the front end - go to the validation tab of the file upload field and under Validation rules put in
maxCount[15]:You have selected too many files!
GreyHead 07 Feb, 2020
Hi Patrick,

Just as a side note you may hit server limitations or get very slow responses if users upload 15 images.

Bob
pat01 07 Feb, 2020
Hi healyhatman and hi Bob

I did check upload max number of files, so no problem there. However, I do testing with 3 files to be on the very safe side🙂

I did try:
maxCount[15]:You have selected too many files!
Limit number of files for Multi file select image 1

But I still can submit the form.

My goal is to show an error message and pretend the form from beeing submitted if number of files is more than three.

I guess this should be possible with
maxCount[15]:You have selected too many files!
?

Thanks.

Patrick
healyhatman 07 Feb, 2020
Yeah front end doesn't look like it's going to work sorry, you're going to have to do it with jQuery. Use the "custom javascript validation" FAQ and something along the lines of https://stackoverflow.com/questions/10105411/how-to-limit-the-maximum-files-chosen-when-using-multiple-file-input

Just remember you need to use jQuery() not $()
pat01 07 Feb, 2020
OK, thanks. I'll check it out.
This topic is locked and no more replies can be posted.