|
@@ 58-64 (lines=7) @@
|
| 55 |
|
public static function upload( |
| 56 |
|
$bucket, $srcPath, $dstPath, $bizAttr = null, $sliceSize = null, $insertOnly = null) |
| 57 |
|
{ |
| 58 |
|
if (!file_exists($srcPath)) { |
| 59 |
|
return [ |
| 60 |
|
'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
| 61 |
|
'message' => 'file '.$srcPath.' not exists', |
| 62 |
|
'data' => [], |
| 63 |
|
]; |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
$dstPath = self::normalizerPath($dstPath, false); |
| 67 |
|
|
|
@@ 269-275 (lines=7) @@
|
| 266 |
|
$srcPath = realpath($srcPath); |
| 267 |
|
$dstPath = self::cosUrlEncode($dstPath); |
| 268 |
|
|
| 269 |
|
if (filesize($srcPath) >= self::MAX_UNSLICE_FILE_SIZE) { |
| 270 |
|
return [ |
| 271 |
|
'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
| 272 |
|
'message' => 'file '.$srcPath.' larger then 20M, please use uploadBySlicing interface', |
| 273 |
|
'data' => [], |
| 274 |
|
]; |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
$expired = time() + self::EXPIRED_SECONDS; |
| 278 |
|
$url = self::generateResUrl($bucket, $dstPath); |