OunknownO OunknownO - 1 year ago 128
PHP Question

max:size method doesn't exist

User needs to have ability to limit upload size and I set that variable and now validation is giving me problems. I have this in my validation

$var = Model::where('id','=','1')->first();


$this->validate($request, [
'file' => "'max:".$up."'",

and it says

Method [validate'max] does not exist.

Answer Source

Assume $up = 10; then validation string must be 'max:10'. Removing single quotes around the max will solve the problem.

So you have to change yout code from:

'file' => "'max:".$up."'" to

'file' => "max:".$up

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download