is it possible to restrict file section for a new media type based on extension?
hey out there,
i was trying to figure out if there's a way to restrict the type of a file a new 'media type' can upload? i know you can globally enable or disable file extensions but i was wondering if there's a way to say:
my new media type with the alias of 'MP4File' can only upload files with an 'mp4' file extension.
is it possible to restrict file section for a new media type based on extension?
hey out there,
i was trying to figure out if there's a way to restrict the type of a file a new 'media type' can upload? i know you can globally enable or disable file extensions but i was wondering if there's a way to say:
be interested to know!
cheers,
jake
Never tried it, but you might be able to hook into Media Service saving event to add some custom logic:
https://our.umbraco.com/Documentation/Reference/Events/MediaService-Events
Most events allow you to cancel the action based on your own logic.
i think you're onto something there dan...
just ran this up and it seems pretty happy:
the file still gets uploaded and in this example it's huge mp4 files which is a bit of a pain....
...but as a simple file extension check, this works a treat ;)
i guess there's only so many times the user will sit and wait for a 1gb video file to upload and then be told it's in the wrong format?!
thank you for the suggestion,
cheers,
jake
Don't you mean:
... && mediaItem.GetValue<string>("umbracoExtension") != "mp4")
?good spot gogo, updated ;)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.