You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by marctaule May 11, 2024
Hi!
I have a problem with the 'upload_multiple' field when updating content.
I have the 'images' field among others, and it's an optional field.
If I don't have any image and I add one, it works correctly. But when I try to edit other fields, it always tells me: 'The images field must be a file of type: jpeg, png, jpg, gif, svg.'
I attach the code I have:
This is my rule: public function rules() { return [ 'name' => 'required|string', 'images' => ValidUploadMultiple::field()->file('mimes:jpeg,png,jpg,gif,svg|max:2048'), ]; }
This is my code in CrudController: CRUD::field([ 'name' => 'images', 'label' => 'Images', 'type' => 'upload_multiple', 'withFiles' => [ 'disk' => 'public', // the disk where file will be stored 'path' => 'images', // the path inside the disk where file will be stored ], 'wrapper' => [ 'class' => 'form-group col-md-6 mb-3' ] ]);
I try different type of field in my database: text, varchar and json and no one work :(
Can anyone help me?
Thanks!
[BUG-TLDR]
Throws false validation error when upload_multiple already has an item and we update without changes.
We are doing a big rework on uploaders, adding tests, bug fixes, and drag-drop Ajax upload support for the editor(similar to the GitHub comment box), etc. It is our priority and is currently in the test phase. It's big, thus taking time. It's in Laravel-Backpack/CRUD#5478
Meanwhile, you can do this:
Create a custom validation class extending Backpack\CRUD\app\Library\Validation\Rules\ValidUploadMultiple
Discussed in #982
Originally posted by marctaule May 11, 2024
Hi!
I have a problem with the 'upload_multiple' field when updating content.
I have the 'images' field among others, and it's an optional field.
If I don't have any image and I add one, it works correctly. But when I try to edit other fields, it always tells me: 'The images field must be a file of type: jpeg, png, jpg, gif, svg.'
I attach the code I have:
This is my rule:
public function rules() { return [ 'name' => 'required|string', 'images' => ValidUploadMultiple::field()->file('mimes:jpeg,png,jpg,gif,svg|max:2048'), ]; }
This is my code in CrudController:
CRUD::field([ 'name' => 'images', 'label' => 'Images', 'type' => 'upload_multiple', 'withFiles' => [ 'disk' => 'public', // the disk where file will be stored 'path' => 'images', // the path inside the disk where file will be stored ], 'wrapper' => [ 'class' => 'form-group col-md-6 mb-3' ] ]);
I try different type of field in my database: text, varchar and json and no one work :(
Can anyone help me?
Thanks!
[BUG-TLDR]
Throws false validation error when
upload_multiple
already has an item and we update without changes.The text was updated successfully, but these errors were encountered: