php - Laravel - Custom validation for file doesn't work -
i trying use custom validation rules file inputs in laravel. file input name "photo". trying apply rule called "validate_art", file input. know there's "image" validation rule, want apply own customized rule file input.
here's code :
$rules = array('name'=>'required|unique:user,name','startyear'=>'numeric','endyear'=>'numeric' ,'photo'=>'validate_art'); validator::extend('validate_art',function($attribute,$value,$parameters){ // returning false testing purpose return false; });
what happens is, doesn't apply rule field @ all. when try use rule other field testing purposes, works without failure. doing wrong? or custom validation cannot applied file inputs? please someone, throw light @ this. appreciate that.
first should modify input data
foreach ($inputs $k=>$input){ if($input instanceof \symfony\component\httpfoundation\file\uploadedfile) $inputs[$k]=$_files[$k]; }
then send $input validator $validator=validator::make($input,$rules)
Comments
Post a Comment