Required image upload with Dropzone.js
Hello !
I have been struggling with this issue for long hours. I have a form with several text inputs, and I added a image upload field using Dropzone.js. What I try to do is making at least 1 image upload required.
I tried the following :
-
paramName is set to 'file' in my Dropzone configuration. I then tried to add 'file' => 'required' to the validation rules of a Post. The 'required' error message displays in all cases, even if I upload multiple photos.
-
I tried to register a custom Validator, to add custom validation rules. My idea was to perform a query on the database to check if at least one photo has previously been registered using ajax. However, my custom rule is not being called ('file' => 'custom_test' does not call validateCustomTest function). I'm under the impression that the rules defined in PostRequest don't know my Dropzone input named 'file'.
Do you have an idea ?
Cheers, Thomas
Please or to participate in this conversation.