Reputation: 1196
I wan't to give user ability to 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 it throws out error
Method [validate'max] does not exist.
Upvotes: 0
Views: 60
Reputation: 9432
You have extra quotes, correct:
$upMz="max:".$upSz."";
$this->validate($request, [
'file' => $upMz,
'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf',
]);
Upvotes: 4