# Ensuring that a file uploaded via FormFunction is of a particular type

I have a FormFunction that should work only with CSV files, something like:

CloudDeploy[FormFunction[{"file" -> "CSV"}, Dimensions[#file] & ],
Permissions -> "Public"]


How can I create a restriction so only CSV files can be submitted?

I want to show a message saying "only CSV files can be uploaded" when someone tries to load an image, and prevent the submit.

I tried this, didn't work:

CloudDeploy[
FormFunction[{"file" -> <|"Interpreter" -> Restricted["CSV"]|>},
Dimensions[#file] & ], Permissions -> "Public"]


CloudDeploy[