File uploads in forms - how to limit file type and number

Hello Everyone,

I would like to restrict the file type in my coda form what users can upload to .pdf. I am trying to use validation but I can’t manage to create a formula which would work. Also is there any way to limit the number of files they upload to a form?

Any suggestion or pointing to the right direction is welcome!

Thanks in advance!

This validation formula seems to work:

CurrentValue.Count()=1 AND CurrentValue.ContainsText(".pdf") 
1 Like

What would be the correct form if I want .pdf and .jpg?
CurrentValue.ContainsText(“.pdf” OR “jpg”)

Is this correct?

There’s probably a more elegant way to do it but this seems to work from my quick test:

CurrentValue.Count()=1 AND OR(CurrentValue.ContainsText(".pdf"), CurrentValue.ContainsText(".jpg")) 
1 Like

Wow! Thanks a lot! I never thought AND and OR works together. But yeah, why not? :smiley:

How would you change the formula in case I put a restriction that the user can upload 2 or more files?

I used this:
CurrentValue.ContainsText(“.pdf”) OR
CurrentValue.ContainsText(“.jpg”) OR
CurrentValue.ContainsText(“.jpeg”)

But what’s happening is that if I try to upload an .xls as the first file, it works well and the error message appears. If I upload .xls as the second file, than there is no error message and the user can submit the form without a problem.

I was playing with ContainsOnly but didn’t find the correct way.
Can you point maybe to the good direction? :slight_smile:

1 Like