|
...
|
...
|
@@ -21,7 +21,7 @@ class CosService |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/19 15:28
|
|
|
|
*/
|
|
|
|
public function uploadFile(&$files,$path,$filename)
|
|
|
|
public function uploadFile(&$files,$path,$filename, $binary = false)
|
|
|
|
{
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosClient = new Client([
|
|
...
|
...
|
@@ -32,11 +32,11 @@ class CosService |
|
|
|
],
|
|
|
|
]);
|
|
|
|
$key = $path.'/'.$filename;
|
|
|
|
$Body = $binary ? $files : fopen($files->getRealPath(), 'r');
|
|
|
|
$cosClient->putObject([
|
|
|
|
'Bucket' => $cos['bucket'],
|
|
|
|
'Key' => $key,
|
|
|
|
// 'Body' => fopen($files->getRealPath(), 'r'),
|
|
|
|
'Body' => $files,
|
|
|
|
'Body' => $Body,
|
|
|
|
]);
|
|
|
|
return $key;
|
|
|
|
}
|
...
|
...
|
|