Disable certain file types from upload
-
Hi,
I’m using WooCommerce and dokan as multivendor plugin.Sadly, by default Dokan don’t have the option to add Media files in product description like in WooCommerce.
It looks like this:
So I found a way to add “Add Media” option that exists in the normal WooCommerce description editor to here as well using this code :
add_action(‘dokan_product_short_description’, ‘add_demo_description’);
function add_demo_description(){
}And now it looks like this :
and it actually works, I can add media library items and upload new ones through the Dokan vendor dashboard, and they also appear on the product page description, which is exactly what I need.
So it looks like this on product page:
So now that users can add their Media in product description, I understood there is a new problem.
the problem is that they can upload any file type here, which is not good because I don’t want people uploading weird stuff to the product description, the only relevant file in my case is MP3, That’s the only file type I want people to be able to insert into the product description.Its also important to be able to limit file size and file amount, so trolls & bots wont be able to upload 10k files at 10gb each and destroy my server.
Any idea what I can do to ensure people can’t insert anything other than MP3 to the product description?
P.S: If you know of ways to style / change that default mp3 media player to something better that would be great.
Thank you!
- The topic ‘Disable certain file types from upload’ is closed to new replies.