我不能让用户限制上传文件的大小。
$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',
]);
它抛出错误
Method [validate'max] does not exist.
答案 0 :(得分:4)
你有额外的引用,正确:
$upMz="max:".$upSz."";
$this->validate($request, [
'file' => $upMz,
'file' => 'mimes:doc,docx,xslx,ppt,pptx,zip,rar,pdf',
]);