コード例 #1
0
ファイル: QiNiu.php プロジェクト: zuozuoba/zpf
 public function getFileInfo($filename)
 {
     require_once LIBPATH . 'Qiniu/rs.php';
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $client = new Qiniu_MacHttpClient(null);
     $info = Qiniu_RS_Stat($client, $this->bucket, $filename);
     return array('info' => $info[0], 'error' => $info[1]);
 }
コード例 #2
0
ファイル: RsTest.php プロジェクト: rwifeng/7niu
 public function testStat()
 {
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $this->key);
     $this->assertArrayHasKey('hash', $ret);
     $this->assertNull($err);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $this->notExistKey);
     $this->assertNull($ret);
     $this->assertFalse($err === null);
 }
コード例 #3
0
 public function exists($filename)
 {
     $this->setBucketAndKey($filename);
     Qiniu_SetKeys($this->accessKey, $this->secretKey);
     $client = new \Qiniu_MacHttpClient(null);
     $result = Qiniu_RS_Stat($client, $this->bucket, $this->key);
     if ($result[0] !== NULL) {
         return true;
     } else {
         return false;
     }
 }
コード例 #4
0
ファイル: RsTest.php プロジェクト: timelessmemory/uhkklp
 public function testStat()
 {
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket . ":" . $this->key);
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_PutFile($upToken, $this->key, __FILE__, null);
     $this->assertNull($err);
     Qiniu_RS_Delete($this->client, $this->bucket, $this->notExistKey);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $this->key);
     $this->assertArrayHasKey('hash', $ret);
     $this->assertNull($err);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $this->notExistKey);
     $this->assertNull($ret);
     $this->assertFalse($err === null);
 }
コード例 #5
0
ファイル: RsUtilsTest.php プロジェクト: timelessmemory/uhkklp
 public function testPut()
 {
     $key = 'tmp/testPut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     list($ret, $err) = Qiniu_RS_Put($this->client, $this->bucket, $key, 'hello world!', null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #6
0
ファイル: IoTest.php プロジェクト: rwifeng/7niu
 public function testPut()
 {
     $key = 'testPut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $key, "hello world!", null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #7
0
ファイル: testqiniu.php プロジェクト: iHamburg/kqserver
 function qiniu()
 {
     echo 'qiniu';
     $bucket = "xappqiniu";
     $key = "apartment_1.jpg";
     $accessKey = 'f9zK0PZeWtFNGY5lxrXeOM6MphG2xxNYBuXv6fGn';
     $secretKey = 'PFSvanHSINAYXoW_-PBTUUNpkA7IU-w7q3pQ1JNj';
     Qiniu_SetKeys($accessKey, $secretKey);
     $client = new Qiniu_MacHttpClient(null);
     list($ret, $err) = Qiniu_RS_Stat($client, $bucket, $key);
     echo "Qiniu_RS_Stat result: \n";
     if ($err !== null) {
         var_dump($err);
     } else {
         var_dump($ret);
     }
 }
コード例 #8
0
ファイル: RioTest.php プロジェクト: rwifeng/7niu
 public function testLargePut()
 {
     $key = 'testRioLargePut' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $upToken = $putPolicy->Token(null);
     $putExtra = new Qiniu_Rio_PutExtra($this->bucket);
     $reader = new MockReader();
     list($ret, $err) = Qiniu_Rio_Put($upToken, $key, $reader, QINIU_RIO_BLOCK_SIZE + 5, $putExtra);
     $this->assertNull($err);
     $this->assertEquals($ret['hash'], "lgQEOCZ8Ievliq8XOfZmWTndgOll");
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #9
0
 public function testPutWithPersistentOps()
 {
     $key = 'testPutWithPersistentOps' . getTid();
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($this->bucket);
     $putPolicy->PersistentOps = 'avthumb/mp3';
     $putPolicy->PersistentNotifyUrl = 'http://someurl/abc';
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $key, "hello world!", null);
     $this->assertNull($err);
     $this->assertArrayHasKey('hash', $ret);
     $this->assertArrayHasKey('persistentId', $ret);
     var_dump($ret);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #10
0
 */
require_once 'bootstrap.php';
if (empty($_COOKIE["uid"]) || (int) $_COOKIE["uid"] < 1) {
    header("Location: login.php");
    exit;
}
$uid = $_COOKIE["uid"];
$userinfo = $db->getOne("SELECT username FROM users WHERE id='{$uid}' LIMIT 1");
$username = $userinfo["username"];
if (isset($_GET["id"])) {
    $id = trim($_GET["id"]);
    $fileRow = $db->getOne("SELECT id, file_key, file_name, file_size, created_at FROM uploads WHERE id='{$id}' LIMIT 1");
    $key = $fileRow["file_key"];
    $attName = $fileRow["file_name"];
    if (!empty($id)) {
        list($ret, $err) = Qiniu_RS_Stat($client, $bucket, $key);
        if ($err == null) {
            $base_url = Qiniu_RS_MakeBaseUrl($domain, $key);
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>相册 - 浏览图片</title>
</head>
<body>

<p>欢迎您,<?php 
コード例 #11
0
ファイル: io_qiniu.php プロジェクト: druphliu/dzzoffice
 function getMeta($path, $force = 0)
 {
     global $_G, $_GET, $documentexts, $imageexts;
     $arr = self::parsePath($path);
     $client = self::init($path, 1);
     $icosdata = array();
     list($meta, $err) = Qiniu_RS_Stat($client, $arr['bucket'], $arr['object']);
     if ($err !== null) {
         runlog('qiniu_log', $err->Code . ':' . $err->Err);
         return array('error' => $err->Code . ':' . $err->Err);
     }
     $meta['key'] = substr($arr['object'], strrchr($meta['key'], '/'));
     $icosdata = self::_formatMeta($meta, $arr);
     return $icosdata;
 }
コード例 #12
0
ファイル: IoTest.php プロジェクト: timelessmemory/uhkklp
 public function testPut_exclusive()
 {
     $key = 'testPut_exclusive' . getTid();
     $scope = $this->bucket . ':' . $key;
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $putPolicy = new Qiniu_RS_PutPolicy($scope);
     $putPolicy->InsertOnly = 1;
     $upToken = $putPolicy->Token(null);
     list($ret, $err) = Qiniu_Put($upToken, $key, "hello world!", null);
     $this->assertNull($err);
     list($ret, $err) = Qiniu_PutFile($upToken, $key, __FILE__, null);
     $this->assertNull($ret);
     $this->assertEquals($err->Code, 614);
     var_dump($err);
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     $this->assertNull($err);
     $this->assertEquals($ret['mimeType'], 'application/octet-stream');
     var_dump($ret);
     $err = Qiniu_RS_Delete($this->client, $this->bucket, $key);
     $this->assertNull($err);
 }
コード例 #13
0
ファイル: getinfo.php プロジェクト: HFO4/shudong-share
    $serverUrl = $row3['p_server'];
    $fileDir = $row3['p_dir'];
    $bucketName = $row3['p_bucketname'];
    $ak = $row3['p_ak'];
    $sk = $row3['p_sk'];
    $operator_name = $row3['p_op_name'];
    $operator_pwd = $row3['p_op_pwd'];
}
if (empty($uploadUser)) {
    $uploadUser = "******";
}
switch ($policyType) {
    case 'qiniu':
        Qiniu_SetKeys($ak, $sk);
        $client = new Qiniu_MacHttpClient(null);
        list($ret, $err) = Qiniu_RS_Stat($client, $bucketName, $ming);
        if ($err !== null) {
            var_dump($err);
        } else {
            echo $ret['fsize'] . "." . $uploadUser . "(UID)" . "." . $ret['mimeType'] . "." . $uploadTime;
        }
        break;
    case 'local':
        $fileAction = fopen(dirname(dirname(__FILE__)) . "/" . $fileDir . "/" . $ming, "r");
        $fileInfo = fstat($fileAction);
        echo $fileInfo['size'] . "." . $uploadUser . "(UID)" . "." . "暂不提供" . "." . $uploadTime;
        fclose($fileAction);
        break;
    case 'server':
        $infoToken = md5($ming . 'info' . $ak);
        $postResult = curl_post($serverUrl, array('action' => 'info', 'filedir' => $fileDir, 'filename' => $ming, 'token' => $infoToken));
コード例 #14
0
ファイル: Qiniu.php プロジェクト: timelessmemory/uhkklp
 /**
  * get file state in qiniu
  * @return [$ret, $err]
  */
 public function getFileInfo($fileName)
 {
     Qiniu_setKeys(QINIU_ACCESS_KEY, QINIU_SECRET_KEY);
     $client = new \Qiniu_MacHttpClient(null);
     return Qiniu_RS_Stat($client, $this->bucket, $fileName);
 }
コード例 #15
0
ファイル: Qiniu.php プロジェクト: callmez/yii2-file-system
 /**
  * Get the metadata of a file
  *
  * @param $path
  * @return array
  */
 public function getMetadata($path)
 {
     list($ret, $err) = Qiniu_RS_Stat($this->getClient(), $this->bucket, $path);
     if ($err !== null) {
         return false;
     }
     $ret['key'] = $path;
     return $this->normalizeData($ret);
 }
コード例 #16
0
ファイル: W2Qiniu.php プロジェクト: alonexy/lea
 /**
  * 查看指定文件是否存在于七牛,及其信息
  * @param  string $key 文件名
  * @return array      信息
  */
 public static function getFileInfoFromQiniu($key)
 {
     Qiniu_SetKeys(W2Config::$Qiniu_accessKey, W2Config::$Qiniu_secretKey);
     $client = new Qiniu_MacHttpClient(null);
     list($ret, $err) = Qiniu_RS_Stat($client, W2Config::$Qiniu_bucket, $key);
     if ($err !== null) {
         return $err;
     } else {
         $ret['urlPreview'] = W2Qiniu::getBaseUrl($key);
         $ret['urlDownload'] = W2Qiniu::getPrivateUrl($ret['urlPreview']);
         return $ret;
     }
 }
コード例 #17
0
ファイル: QiniuClass.php プロジェクト: huangbinzd/kppwGit
 public function viewFileInfoByKey($key)
 {
     list($ret, $err) = Qiniu_RS_Stat(new Qiniu_MacHttpClient(null), $this->_Bucket, $key);
     var_dump($ret, $err);
 }
コード例 #18
0
ファイル: Qiniu.php プロジェクト: Doweidu/DWDQiniuSdkBundle
 public function stat($key)
 {
     list($ret, $err) = Qiniu_RS_Stat($this->client, $this->bucket, $key);
     if ($err !== null) {
         throw new QiniuStatException($err->Err, $err->Code, $key);
     } else {
         return $ret;
     }
 }