public function fileUpload(Request $request){
if (empty($request->file('file'))){
return $this->fail('请上传文件');
}
$config = config('filesystems.disks.s3');
try{
// Log::info(json_encode($request->file));
$path = Storage::disk('s3')->put('file', $request->file('file'),'public');
}catch (\Exception $exception){
return $this->fail($exception->getMessage());
}
// $path = $request->file('file')->store('img', 's3');
return $this->ok('https://'.$config['bucket'].'.s3.'.$config['region'].'.amazonaws.com/'.$path);
}
ygdy8