I want to set up a file upload in Directus that only allows PDF files, basically input validation based on MIME type or file extension. I couldn’t find anything in the documentation that explains how to enforce this restriction.
Hello, try setting this rule to the directus_files
in the create.
{"_and":[{"type":{"_eq":"application/pdf"}}]}
In addition to @ahmad_quvor post you can checkout this thread for an idea of how to limit upload with a custom hook Choose files type/extension (mimetype) · directus/directus · Discussion #11733 · GitHub.
And you could also limit the allowed MIME types for the whole Directus instance using FILES_MIME_TYPE_ALLOW_LIST
environment varable https://directus.io/docs/configuration/files#upload-limits