• Resolved Cheryl

    (@tricheryltops)


    I need to upload a .ttf file to a plugin and my site was not allowing me to do so.

    Adding a snippet to functions.php didn’t work.
    I tried temporarily adding define( ‘ALLOW_UNFILTERED_UPLOADS’, true); to wp-config.php
    But that didn’t work.
    So I tried this plugin, which also didn’t work.
    The upload is to a plugin so, while I can upload a .ttf file directly, I cannot add it to the plugin as it does not show up in the media library.
    It has to be a .ttf file, .woff will not work for this purpose.
    I’ve tried clearing caches.
    Any idea how I can get this to work?
    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @tricheryltops,

    Thanks for reaching out. This usually happens if an incorrect MIME type is configured for the file. You can upload .ttf file in the MIME Type Checker tool and configure the correct MIME type. Usually, it is font/ttf. If that doesn’t help, could you please share the .ttf file you’re having an issue with?

    Note: you should not use define( ‘ALLOW_UNFILTERED_UPLOADS’, true); — it’s compromising your site’s security.

    Regards,

    Thread Starter Cheryl

    (@tricheryltops)

    Hi,
    Thanks for the response. I realize I should not allow unfiltered uploads. I tried it for about one minute to see if I could upload the file and then removed it.

    I used the MIME type checker and it’s:

    application/x-font-ttf

    I’ve tried the .ttf in plugin settings and tried configuring it manually and nothing works.

    The file I’m trying is just a Playfair Display variable font weight .ttf downloaded from Google Fonts. A sharing plugin allows you to enter a custom ttf to output a text to image share.
    Thanks

    Hi @tricheryltops,

    Thanks for the information. Could you please share the exact error message you’ve got while uploading the file in Dashboard > Media library, or screenshot where you’re trying to upload and isn’t working? Details from the Tools > Site Health could also be helpful to narrow down the issue.

    Regards,

    Thread Starter Cheryl

    (@tricheryltops)

    Here’s a screenshot:

    https://nimb.ws/SfyOZY

    I was getting the “Sorry, this file type is not permitted for security reasons.” error.

    However, I temporarily allowed unfiltered uploads again, adjusting the placement in wp-config.php and it worked — then I removed it from wp-config.php after I uploaded the .ttf file.
    Thanks.

    Hi @tricheryltops,

    I’m glad you sorted that out anyway. Usually, that isn’t a safe approach because you never know what the uploaded file contains because it skips the file content check.

    Have a good one! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not working for .ttf file upload’ is closed to new replies.