Buy Now
Sign in

Limit number of files for Multi file select

pat01 , February 07 2020, 09:10
pat01 300
February 07 2020, 09:10 #391072
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 9
February 07 2020, 10:26 #391073
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!
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
GreyHead 64
February 07 2020, 10:34 #391075
Hi Patrick,
Just as a side note you may hit server limitations or get very slow responses if users upload 15 images.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
pat01 300
February 07 2020, 10:52 #391076
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!
Screenshot_1.jpg
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
Attachments
Screenshot_1.jpg
Screenshot_1.jpg
(29.65 KiB)
49 Downloads/Views
healyhatman 9
February 07 2020, 12:42 #391080
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 $()
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
pat01 300
February 07 2020, 13:57 #391087
OK, thanks. I'll check it out.