|
@@ 58-63 (lines=6) @@
|
| 55 |
|
public static function upload($bucketName, $srcPath, $dstPath, |
| 56 |
|
$bizAttr = null, $sliceSize = null, $insertOnly = null) |
| 57 |
|
{ |
| 58 |
|
if (!file_exists($srcPath)) { |
| 59 |
|
return [ |
| 60 |
|
'code' => self::COSAPI_PARAMS_ERROR, |
| 61 |
|
'message' => 'file '.$srcPath.' not exists', |
| 62 |
|
'data' => [], ]; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
$dstPath = '/'.ltrim($dstPath, '/'); |
| 66 |
|
|
|
@@ 319-324 (lines=6) @@
|
| 316 |
|
$srcPath = realpath($srcPath); |
| 317 |
|
$dstPath = self::cosUrlEncode($dstPath); |
| 318 |
|
|
| 319 |
|
if (filesize($srcPath) >= self::MAX_UNSLICE_FILE_SIZE) { |
| 320 |
|
return [ |
| 321 |
|
'code' => self::COSAPI_PARAMS_ERROR, |
| 322 |
|
'message' => 'file '.$srcPath.' larger then 20M, please use upload_slice interface', |
| 323 |
|
'data' => [], ]; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
$expired = time() + self::EXPIRED_SECONDS; |
| 327 |
|
$url = self::generateResUrl($bucketName, $dstPath); |
|
@@ 501-507 (lines=7) @@
|
| 498 |
|
$srcPath, false, null, |
| 499 |
|
$offset, $sliceSize); |
| 500 |
|
|
| 501 |
|
if ($filecontent === false) { |
| 502 |
|
return [ |
| 503 |
|
'code' => self::COSAPI_PARAMS_ERROR, |
| 504 |
|
'message' => 'read file '.$srcPath.' error', |
| 505 |
|
'data' => [], |
| 506 |
|
]; |
| 507 |
|
} |
| 508 |
|
|
| 509 |
|
$boundary = '---------------------------'.substr(md5(mt_rand()), 0, 10); |
| 510 |
|
$data = self::generateSliceBody( |