|
...
|
...
|
@@ -44,13 +44,13 @@ class TencentCosService extends BaseService |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/19 14:47
|
|
|
|
*/
|
|
|
|
public function uploadToCos($file,$path,$filename)
|
|
|
|
public function uploadToCos($path,$filename)
|
|
|
|
{
|
|
|
|
$objectKey = $path.'/'.$filename;
|
|
|
|
// 上传到腾讯云 COS
|
|
|
|
$httpClient = new Client();
|
|
|
|
$response = $httpClient->request('PUT', "https://{$this->config['bucket']}.cos.{$this->config['cosRegion']}.myqcloud.com/{$objectKey}", [
|
|
|
|
'body' => file_get_contents($file->getRealPath()),
|
|
|
|
'body' => file_get_contents(config('filesystems.disks.upload')['root'].$objectKey),
|
|
|
|
'headers' => $this->generateHeaders($this->config['secretId'], $this->config['secretKey']),
|
|
|
|
]);
|
|
|
|
// 若上传成功,则返回上传后的 URL
|
...
|
...
|
|