Added client-side file validator

This pull request is proposal for #4356 Client-side file validator
Instead of checking `file` here, I suggest we do the conversion within the `file()` function.