12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- require dirname(__FILE__) . '/../vendor/autoload.php';
- $secretId = "COS_SECRETID";
- $secretKey = "COS_SECRETKEY";
- $region = "ap-beijing";
- $cosClient = new Qcloud\Cos\Client(
- array(
- 'region' => $region,
- 'schema' => 'https',
- 'credentials'=> array(
- 'secretId' => $secretId ,
- 'secretKey' => $secretKey)));
- $local_path = "/data/exampleobject";
- try {
- $result = $cosClient->upload(
- $bucket = 'examplebucket-125000000',
- $key = 'exampleobject',
- $body = fopen($local_path, 'rb')
-
- );
-
- print_r($result);
- } catch (\Exception $e) {
-
- echo($e);
- }
|