Open tifabien opened 6 years ago
@tifabien is there still the need for the symfony form validation? Because its already happening on js side with mimetype and file extension
IIRC symfony will release symfony/mime component soon. Can this help?
The mime-types comes from provider so before post to multiUploadAction it gets validated. So the validation depends on the configuration of the provider
sonata.media.provider.video:
# ...
arguments:
# ....
- ['mp4', 'mov', 'flv', 'wmv', 'mxf', 'mkv','m4v','mpg']
- ['video/mp4', 'video/quicktime', 'video/x-flv','video/x-ms-wmv','application/mxf','video/x-matroska','video/x-m4v','video/mpeg']
@silasjoisten I don't really remember the origin of my issue but I think there is still a need of using the Symfony form validation as I think we should not trust only the client side and do also our own validation in the controller method (isFormValid, handleRequest, ...) This way we could also for exemple use the Validator component in the Media Entity.
Hi,
I'm using the bundle and my user raised an issue related to file extensions. It seems that the
allowedExtensions
and theallowedMimeTypes
properties are not took into account when theMultiUploadController::multiUploadAction
method is used.How can we do to validate the media when this controller action is called and how can we handle the form violation messages in the view?
Thanks for your help!