Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Allow custom type file upload
- This topic has 1 reply, 2 voices, and was last updated 5 years, 1 month ago by Sushobhan.
- AuthorPosts
- November 14, 2019 at 7:11 am #92232tomasbresciaParticipant
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!
- November 16, 2019 at 5:49 pm #92559SushobhanKeymaster
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.
- AuthorPosts
- The topic ‘Allow custom type file upload’ is closed to new replies.