Search code examples
fileuploadsilverstripetruetype

Silverstripe TTF file upload


I'm trying to have a upload field to upload TTF file to my website. But when trying to upload it fails - it says forbidden.

How can I have upload field to upload just TTF files.


Solution

  • You have to tell File class to allow that file type by adding it to the config, e.g. in mysite/_config/config.yml:

    File:
      allowed_extensions:
        - ttf
    

    You'll also have to whitelist it in your /assets/.htaccess