[Bug] File type column cannot read the selected filename

@praveen @brian @tony
When I use a File type column, there are some certain cases that I don’t want the users to upload files other than PDF, DOC or restrict the upload of certain file types like PNG, JPG etc. To verify this shall be as easy as constructing a Valid_if expression like:

".PDF" = UPPER(RIGHT([FileColumnName],4))

However, whatever way you construct this kind of expression to ensure the file type, the expression evaluates to a null value (empty string) and therefore always eval to FALSE.

Hi Levent, this seems like a good use case that the platform should support. The reason that this doesn’t work right now is due to the way that AppSheet represents files. The platform only creates the file name after the record is synced. So the filename is not yet available during form validation. Do you mind if I switch this to a feature request?

2 Likes

Hello @tony
Sure you can switch. But this is a very important case that we should be able to read the uploaded/selected filename so that we can restrict the type of files to be selected. For example I have a public app which users can upload files which I only need either a PDF or a DOC/DOCX file. As it’s a public facing app I don’t want some lamers to upload XXX pictures instead for example. So there should be a way to accomplish this.

2 Likes

A workaround for the mean while would be a “staging” table of sorts where it gets checked and then the user returns there is the file type is invalid or they continue on if it is valid.

Definitely agree with the feature becoming native though.
Got my vote!

1 Like

Hi @LeventK maybe you could use the Google API to detect explicit content:

https://cloud.google.com/vision/docs/detecting-safe-search

I think this is a common enough use case that we’d want to have something in the File column type definition that identifies what the allowed mime types (or equvalently, file extensions) are. It is just a more structured way of representing a valid_if constraint that occurs a lot. That way, the file picker itself could be limited to fetching files of the desired types.
@natalie fyi

3 Likes