作者 lyh

gx

... ... @@ -155,7 +155,7 @@ class ImageController extends Controller
//同步数据到cos
if($this->upload_location == 1){
$cosService = new CosService();
$cosService->uploadFile($this->path,$fileName);
$cosService->uploadFile($files,$this->path,$fileName);
}else{
$res = $files->move($url,$fileName);
if ($res === false) {
... ...
... ... @@ -20,7 +20,7 @@ class CosService
* @method :post
* @time :2023/7/19 15:28
*/
public function uploadFile($path,$filename)
public function uploadFile(&$files,$path,$filename)
{
$cos = config('filesystems.disks.cos');
$cosClient = new Client([
... ... @@ -34,7 +34,7 @@ class CosService
$cosClient->putObject([
'Bucket' => $cos['bucket'],
'Key' => $key,
'Body' => fopen(config('filesystems.disks.upload')['root'].$path.'/'.$filename, 'r'),
'Body' => fopen($files->getRealPath(), 'r'),
]);
return $key;
}
... ...