public function uploadFile() {
$file = request()->file('file');
try {
validate(['image'=>'fileSize:10240'])->check([$file]);
$path = \think\facade\Filesystem::disk('public')->putFile( 'customer_attachment', $file);
return json(['code' => 1, 'msg' => '上传成功', 'data' => $path]);
} catch (\think\exception\ValidateException $e) {
return json(['code' => 0, 'msg' => $e->getMessage()]);
}
}
【PHP】上传代码
最新推荐文章于 2024-08-12 16:47:32 发布