Use file validation with php library

I’m using the php library and have data-input-accept-types working, but drag and drop works around it. How do I link file validators using the php lib?

Hi @mharney,

You can do this with file validation. It’s not implemented in the PHP library, but you can add it with custom Java Script. Check out the following article to learn more about how to add validation

Here is a link to a code example that shows how to validate a file by type

Thank you for the response.

Maybe my question is more generic; assuming I do what configuration is available via the php library, can I then add the file validator via Javascript, or should I bail on the php lib and just use Javascript for everything?

@mharney I think it depends on what you need to do with files. If you don’t need to utilize Uploadcare REST API methods such as file copying, removing, etc. You can use the client-side JS library (widget) only. Otherwise, using the PHP library would be a better choice. However, some things would still require client-side JS (i.e. file validation).