@@ 69-75 (lines=7) @@ | ||
66 | */ |
|
67 | public static function upload($bucket, $srcPath, $dstPath, $bizAttr = null, $sliceSize = null, $insertOnly = null) |
|
68 | { |
|
69 | if (!file_exists($srcPath)) { |
|
70 | return [ |
|
71 | 'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
|
72 | 'message' => 'file '.$srcPath.' not exists', |
|
73 | 'data' => [], |
|
74 | ]; |
|
75 | } |
|
76 | ||
77 | $dstPath = self::normalizerPath($dstPath, false); |
|
78 | ||
@@ 301-307 (lines=7) @@ | ||
298 | $srcPath = realpath($srcPath); |
|
299 | $dstPath = self::cosUrlEncode($dstPath); |
|
300 | ||
301 | if (filesize($srcPath) >= self::MAX_UNSLICE_FILE_SIZE) { |
|
302 | return [ |
|
303 | 'code' => ErrorCode::COSAPI_PARAMS_ERROR, |
|
304 | 'message' => 'file '.$srcPath.' larger then 20M, please use uploadBySlicing interface', |
|
305 | 'data' => [], |
|
306 | ]; |
|
307 | } |
|
308 | ||
309 | $expired = self::time() + self::EXPIRED_SECONDS; |
|
310 | $url = self::generateResUrl($bucket, $dstPath); |