|
@@ 59-65 (lines=7) @@
|
| 56 |
|
*/ |
| 57 |
|
public static function upload($bucket, $srcPath, $dstPath, $bizAttr = null, $sliceSize = null, $insertOnly = null) |
| 58 |
|
{ |
| 59 |
|
if (!file_exists($srcPath)) { |
| 60 |
|
return [ |
| 61 |
|
'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
| 62 |
|
'message' => 'file '.$srcPath.' not exists', |
| 63 |
|
'data' => [], |
| 64 |
|
]; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
$dstPath = self::normalizerPath($dstPath, false); |
| 68 |
|
|
|
@@ 291-297 (lines=7) @@
|
| 288 |
|
$srcPath = realpath($srcPath); |
| 289 |
|
$dstPath = self::cosUrlEncode($dstPath); |
| 290 |
|
|
| 291 |
|
if (filesize($srcPath) >= self::MAX_UNSLICE_FILE_SIZE) { |
| 292 |
|
return [ |
| 293 |
|
'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
| 294 |
|
'message' => 'file '.$srcPath.' larger then 20M, please use uploadBySlicing interface', |
| 295 |
|
'data' => [], |
| 296 |
|
]; |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
$expired = time() + self::EXPIRED_SECONDS; |
| 300 |
|
$url = self::generateResUrl($bucket, $dstPath); |