This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hey Guys,
Is it possible to ensure that file is attached to model?
I tried
public $rules = [
'slides' => 'required',
];
public $attachMany = [
'slides' => ['System\Models\File'],
];
slides:
type: fileupload
mode: image
required: true
but without any desired result.
I was just discussing this with daftspunk and he has already taken care of it, I think he said it should be in the next build.
https://github.com/daftspunk/oc-test-plugin/commit/e9adedc12ec0e2c885359577edecd908cab749ab
Hi, I have the same issue. I am running latest version of October (434).
Max size validations are working fine for all, except $attachMany images. For below example, "featured_image" is limited to 1024 (fine). But I can still upload images higher than 512 for "images"
public $rules = [ 'featured_image' => 'max:1024', 'images' => 'max:512', ];
public $attachOne = [ 'featured_image' => 'System\Models\File', 'document' => 'System\Models\File', 'document_fr' => 'System\Models\File' ]; public $attachMany = [ 'images' => 'System\Models\File' ];
featured_image: label: 'acte.destinations::lang.common.featured_image' mode: image useCaption: true thumbOptions: mode: crop extension: auto span: auto type: fileupload tab: Images images: label: 'acte.destinations::lang.common.images' mode: image useCaption: true thumbOptions: mode: crop extension: auto span: full type: fileupload tab: Images
Last updated
Hi, I have a similar problem.
I tried to use validation rules for arrays, as described in the Laravel documentation. But it does not work.
Is this something I'm doing wrong, or is validation not possible in this way?
use Validation;
public $attachMany = [
'photos' => File::class
];
public $rules = [
'photos' => 'required',
'photos.*' => 'image|max:1000|dimensions:min_width=100,min_height=100'
];
With these rules, I get an error The photos.0 must be an image.
1-6 of 6