Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to limit the file types that editors can upload.
Given that the media library and the entire file upload functionality of Umbraco is lacking big time, I am trying to limit the file types allowed through the MediaService.Saving event.
I have an event set up that checks the ContentType alias and then checks the file extension. If it is not a PDF then I stop the saving of the content.
My problem is that most of my users will be uploading the files directly from the Media Picker data type. Is there a way to link the Media Picker to a certain Media Type? The default seems to be Umbraco deciding that anything that isn't an image must then be a File.
There is a list of extensions in config/umbracoSettings.config file to limit/allow types. I hope it would be enough for you.
I believe image types is included in v8 a little different, below are from v7.
<!-- These file types will not be allowed to be uploaded via the upload control for media and content -->
<!-- If you add a new image file type to umbraco, make sure you update ApplicationEventRegisters.cs IsFileImage method -->
Thanks for the reply, but unfortunately this would limit the files that can be uploaded globally within Umbraco. I want to limit them for a single media picker.
I have since figured out that the Multinode Treepicker allows me to select the media type I wish to use. Then I can create the customMediaService.Saving event to check a custom config setting to limit the file types.
Still to be tested, but it should work.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted