tp6 上传验证问题

浏览:6516 发布日期:2020/04/09 分类:ThinkPHP6专区
$files = request()->file();
// dump($files);
try {
validate(['file' => [
'fileSize' => 10240,
'fileExt' => 'jpg,png,gif,jpeg',
'fileMime' => 'image/jpeg,image/png,image/gif',
]])->check((array)$files);
$savename = \think\facade\Filesystem::putFile('topic', $files);
dump($savename););
} catch (ValidateException $e) {
echo $e->getMessage();
}
首先 fileSize 的单位是 b 对吧
我写个 1024 太小 会提示 上传文件大小不符!
下大了 报错
Argument 2 passed to think\\filesystem\\Driver::putFile() must be an instance of think\\File, array given, called in \/www\/test\/tp6novel\/vendor\/topthink\/framework\/src\/think\/Manager.php on line 184
最佳答案
评论( 相关
后面还有条评论,点击查看>>