Open DariuS231 opened 4 years ago
I think it was there, but removed for a reason
/cc @deanmarcussen
There isn't a setting for the field as such.
Instead we use an AllowedFileExtensions
setting for the media app, allowing you to change which files can be uploaded to the media app.
See the end of this doc. https://orchardcore.readthedocs.io/en/dev/docs/reference/modules/Media/
The MediaField could have a custom editor option to restrict a particular field to specific files only, but I think the AllowedFileExtensions
should be enough for most users.
@DariuS231 seems this answer your question
@hishamco @deanmarcussen Not really, I was aware of AllowedFileExtensions
but that is not what I was talking about.
What I meant was to limit the media file to only accept the specified type of files.
e.g.: Only allow users from uploading .gif files. they wouldn't be able to select it or if they drag and drop, they would see an error message.
What I meant was to limit the media file to only accept the specified type of files
AllowedFileExtensions
will allow you to do such this
but in a global context, What about a particular field? I want other field to accept all kinds of files.
Frankly I didn't try it, so I will reopen this again
The requirement makes sense. Could be a setting for the default editor.
What if we use AllowedFileExtensions
directly in the media field?
That would imply a setting entry per file field would be required in the config file. Wouldn't that be awkward?
What I had in mind was to add a new setting to the field editor and will then render the File Input accordingly.
That's what Seb suggested above
Yes exactly that @DariuS231
It would be a setting on the field and as a default setting is probably best as it would then work for both normal media field and attached.
Two settings. One bool restrict file types. The next a select for which file types to accept. The vue multiselect editor would give good for this. It should take it’s possible values from the AllowedFileExtensions
Two settings.
I think by setting the AllowedFileExtensions
to accept property will restrict the file types
Another useful feature here would be to have a setting to restrict which folders (or the default folder that is opened) the user can select from.
e.g. /seo-images
or /video-content
Makes it easy to handle organising media, and directing users to the correct media folder.
I like it Dean, you remind me with a CMS that I developed few years ago where I have notion of Media Libraries, so the media can pick up from a specified library, also what you mentioned is good for organization and security point of views
We use MediaPicker field in order to pick icon files for MenuItem, it will be nice having the ability to filter by file type. Any updates on this ticket?
@rserj still open, feel free to implement it as a setting of the field.
It would be nice to have a setting for the Media Field to filter files.
e.g.: only allow "image/png, image/jpeg" files. will translate into: