php - laravel validation add custom var -


i wan't give user ability limit upload file size.

    $uploadsize = settings::where('id','=','1')->first();     $upsz=$uploadsize->uploadsize;     $upmz="'max:".$upsz."'";     $this->validate($request, [         'file' => $upmz,         'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf',          ]); 

and throws out error

method [validate'max] not exist. 

you have quotes, correct:

$upmz="max:".$upsz.""; $this->validate($request, [         'file' => $upmz,         'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf',          ]); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -