public function copyObject($args = array())
 {
     if (parent::objectExists(array("Bucket" => $args["Bucket"], "Key" => $args["Key"]))) {
         throw new Ks3ClientException("copy object faild,destination object exists");
     }
     if (parent::objectExists(array("Bucket" => $args["CopySource"]["Bucket"], "Key" => $args["CopySource"]["Key"] . EncryptionUtil::$INSTRUCTION_SUFFIX))) {
         parent::copyObject(array("Bucket" => $args["Bucket"], "Key" => $args["Key"] . EncryptionUtil::$INSTRUCTION_SUFFIX, "CopySource" => array("Bucket" => $args["CopySource"]["Bucket"], "Key" => $args["CopySource"]["Key"] . EncryptionUtil::$INSTRUCTION_SUFFIX)));
     }
     return parent::copyObject($args);
 }
Пример #2
0
<?php

//更加详细的表单上传请参考js sdk
require_once "../Ks3Client.class.php";
$client = new Ks3Client("1GL02rRYQxK8s7FQh8dV", "2IDjaPOpFfkq5Zf9K4tKu8k5AKApY8S8eKV1zsRl");
$bucket_name = "phpsdktestlijunwei";
if (!$client->bucketExists(array("Bucket" => $bucket_name))) {
    $client->createBucket(array("Bucket" => $bucket_name));
}
$key = 'formuploadtest/@中文.txt';
$host = "kss.ksyun.com";
$host_uri = "http://" . $host . "/" . $bucket_name;
$redirect = $host_uri;
//将所有能确定值的表单项都放在该数组中
$postData = array("key" => $key, "success_action_redirect" => $redirect, "Content-Type" => "text/html");
//将不能确定值的表单项都放在该数组中
$unknowData = array("random");
$result = $client->postObject($bucket_name, $postData, $unknowData);
print_r($result);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="<?php 
echo $host_uri;
?>
" method="post" enctype="multipart/form-data">
Key to upload: <input type="input" name="key" value="<?php 
echo $key;