wcfm-santa

Making Christmas merrier with our special gift! Enjoy upto 25% off on all WCFM Addons.

CLAIM OFFER
00Day 21Hr 33Min 22Sec

Allow custom type file upload

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 1 reply thread
  • Author
    Posts
    • #92232
      tomasbrescia
      Participant

      Hello!

      I’m currently working on allowing some custom file types for downloadable products without luck.

      I need to allow vendors upload ‘.ex4’, ‘.ex5’ and ‘.mql’ files.

      Would you guys help me achieve this?

      Thanks!

    • #92559
      Sushobhan
      Keymaster

      Hello,
      WCFM allows for the same file extensions defined by WordPress. You can see the full list via WordPress Codex: Uploading Files.
      You can add additional allowed extensions by using ‘upload_mimes’ filter. Take a look at the the following sample code –

      function my_custom_mime_types( $mimes ) {
          // New allowed mime types.
          $mimes['ex4'] = 'application/octet-stream'; //mime type of the file goes here
          $mimes['ex5'] = 'application/octet-stream';
          $mimes['mql'] = 'application/octet-stream';
          return $mimes;
      }
      
      add_filter( 'upload_mimes', 'my_custom_mime_types' );

      Add this code to your child theme’s functions.php

      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      Note: A quick Google search suggest me the mime type ‘application/octet-stream’. If the above code doesn’t work please check the mime type of each of these extensions from here https://htmlstrip.com/mime-file-type-checker.

Viewing 1 reply thread
  • The topic ‘Allow custom type file upload’ is closed to new replies.