uploadDir() public méthode

上传本地目录内的文件或者目录到指定bucket的指定prefix的object中
public uploadDir ( string $bucket, string $prefix, string $localDirectory, string $exclude = '.|..|.svn|.git', boolean $recursive = false, boolean $checkMd5 = true ) : array
$bucket string bucket名称
$prefix string 需要上传到的object的key前缀,可以理解成bucket中的子目录,结尾不能是'/',接口中会补充'/'
$localDirectory string 需要上传的本地目录
$exclude string 需要排除的目录
$recursive boolean 是否递归的上传localDirectory下的子目录内容
$checkMd5 boolean
Résultat array 返回两个列表 array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage"))
/**
 * 按照目录上传文件
 *
 * @param OssClient $ossClient OssClient
 * @param string $bucket 存储空间名称
 *
 */
function uploadDir($ossClient, $bucket)
{
    $localDirectory = ".";
    $prefix = "samples/codes";
    try {
        $ossClient->uploadDir($bucket, $prefix, $localDirectory);
    } catch (OssException $e) {
        printf(__FUNCTION__ . ": FAILED\n");
        printf($e->getMessage() . "\n");
        return;
    }
    printf(__FUNCTION__ . ": completeMultipartUpload OK\n");
}