Hi All,
I’m a french user of kobotoolbox (sorry for my english ). I’m trying to limit a file question to PDF and Word formats (.pdf, .doc and .docx). I used body::accept column in an xls form to specify it.
When I open the Enketo form, it remains possible to upload another type of file such as image, excel file. I also try to activate it directly on the builder but I have the same issue.
Welcome to the community, @adebayoltj! It seems like you tried this with Enketo. Could you also try it out with the Collect android app to see how it behaves?
Hi @adebayoltj, using the body::accept to specify accepted file formats only filters for these formats in the device’s file picker — unfortunately it does not restrict one from uploading a file that is outside of the desired formats. So in other words, it is a guide for the person completing the survey rather than a security feature.
Hi, @adebayoltj and to anyone looking for a similar solution, I used the constraint column of my file question with a regex to only accept PDF and Word documents. The regex is: regex(., '.*\.(docx|doc|pdf)$'). In addition to using body::accept with the following value: application/pdf,.doc,.docx
This still allows the user to browse and select other file types, but the constraint will prevent the user from submitting until they choose PDF or Word, and the body::accept will browse by default for these types only.