Пример #1
0
function Qiniu_RS_RputFile($self, $bucket, $key, $localFile, $putExtra)
{
    $putPolicy = new Qiniu_RS_PutPolicy("{$bucket}:{$key}");
    $upToken = $putPolicy->Token($self->Mac);
    if ($putExtra == null) {
        $putExtra = new Qiniu_Rio_PutExtra($bucket);
    } else {
        $putExtra->Bucket = $bucket;
    }
    return Qiniu_Rio_PutFile($upToken, $key, $localFile, $putExtra);
}
Пример #2
0
 /**
  * Upload file to qiniu cloud
  * @param  string $filePath file path
  * @param  string $key      file name in qiniu
  * @param  bool   $isAllowedOverwrite
  */
 public function upload($filePath, $key, $isAllowedOverwrite = false)
 {
     if ($isAllowedOverwrite) {
         $upToken = $this->getToken($key);
     } else {
         $upToken = $this->getToken();
     }
     if (filesize($filePath) > 1 << self::QINIU_UPLOAD_BLOCK_BITS) {
         LogUtil::info(['message' => 'upload file use block', 'filePath' => $filePath], 'resque');
         $putExtra = new \Qiniu_Rio_PutExtra();
         list($ret, $err) = Qiniu_Rio_PutFile($upToken, $key, $filePath, $putExtra);
     } else {
         LogUtil::info(['message' => 'upload file directly', 'filePath' => $filePath], 'resque');
         $putExtra = new \Qiniu_PutExtra();
         $putExtra->Crc32 = 1;
         list($ret, $err) = Qiniu_PutFile($upToken, $key, $filePath, $putExtra);
     }
     if ($err !== null) {
         return $err;
     } else {
         return $ret;
     }
 }
function apQiniu_RS_RputFile($self, $bucket, $key, $localFile, $putExtra)
{
    $bjbbkvh = "putPolicy";
    ${$bjbbkvh} = new Qiniu_RS_PutPolicy_apf("{$bucket}:{$key}");
    ${"GLOBALS"}["kzxjgf"] = "upToken";
    ${"GLOBALS"}["iowuwfyio"] = "upToken";
    ${${"GLOBALS"}["kzxjgf"]} = $putPolicy->Token($self->Mac);
    ${"GLOBALS"}["vjljcboi"] = "key";
    $sxcfgegcn = "putExtra";
    $ekrnpcgd = "localFile";
    if (${${"GLOBALS"}["dxgslnvcwgui"]} == null) {
        ${"GLOBALS"}["zdkseumjj"] = "putExtra";
        ${${"GLOBALS"}["zdkseumjj"]} = new Qiniu_Rio_PutExtra_apf(${${"GLOBALS"}["pxnuytuk"]});
    } else {
        ${"GLOBALS"}["grcwohz"] = "bucket";
        $putExtra->Bucket = ${${"GLOBALS"}["grcwohz"]};
    }
    return Qiniu_Rio_PutFile(${${"GLOBALS"}["iowuwfyio"]}, ${${"GLOBALS"}["vjljcboi"]}, ${$ekrnpcgd}, ${$sxcfgegcn});
}
Пример #4
0
    var_dump($ret);
}
# @endgist
Qiniu_RS_Delete($client, $bucket, $key1);
# @gist getpolicy
$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key1);
$getPolicy = new Qiniu_RS_GetPolicy();
$privateUrl = $getPolicy->MakeRequest($baseUrl, null);
echo "\n\n====> getPolicy result: \n";
echo $privateUrl . "\n";
# @endgist
//------------------------------------rio-----------------------------------------
//Qiniu_Rio_PutFile($upToken, $key1, $localFile, $putExtra) // => ($putRet, $err)
# @gist rio_putfile
$putExtra = new Qiniu_Rio_PutExtra($bucket);
list($ret, $err) = Qiniu_Rio_PutFile($upToken, $key1, $file, $putExtra);
echo "\n\n====> Qiniu_Rio_PutFile result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);
}
# @endgist
//------------------------------------rs-----------------------------------------
# @gist stat
list($ret, $err) = Qiniu_RS_Stat($client, $bucket, $key1);
echo "\n\n====> Qiniu_RS_Stat result: \n";
if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);