当前位置: 首页>>代码示例>>PHP>>正文


PHP AmazonS3::get_object_list方法代码示例

本文整理汇总了PHP中AmazonS3::get_object_list方法的典型用法代码示例。如果您正苦于以下问题:PHP AmazonS3::get_object_list方法的具体用法?PHP AmazonS3::get_object_list怎么用?PHP AmazonS3::get_object_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AmazonS3的用法示例。


在下文中一共展示了AmazonS3::get_object_list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getS3ObjectList

 /**
  * Get a list of objects from within a bucket
  * @param string $dir
  * @return array
  */
 public function getS3ObjectList($dir)
 {
     $c['delimiter'] = '/';
     if (!empty($dir) && $dir != '/') {
         $c['prefix'] = $dir;
     }
     $list = array();
     $cps = $this->driver->list_objects($this->bucket, $c);
     foreach ($cps->body->CommonPrefixes as $prefix) {
         if (!empty($prefix->Prefix) && $prefix->Prefix != $dir && $prefix->Prefix != '/') {
             $list[] = (string) $prefix->Prefix;
         }
     }
     $response = $this->driver->get_object_list($this->bucket, $c);
     foreach ($response as $file) {
         $list[] = $file;
     }
     return $list;
 }
开发者ID:nervlin4444,项目名称:modx-cms,代码行数:24,代码来源:mods3mediasource.class.php

示例2: uniqueFile

 /**
  * Ensure that an uploaded file is unique
  *
  * @param string  $prefix
  * @param string  $fileName
  */
 protected function uniqueFile($prefix, $fileName)
 {
     // request a list of objects filtered by prefix
     $list = $this->s3->get_object_list($this->bucket, compact('prefix'));
     $path = join('/', array($prefix, $fileName));
     $i = 0;
     while (in_array($path, $list)) {
         $i++;
         $parts = explode('.', $fileName);
         $ext = array_pop($parts);
         $parts = array_diff($parts, array("copy{$i}", "copy" . ($i - 1)));
         $parts[] = "copy{$i}";
         $parts[] = $ext;
         $path = join('/', array($prefix, implode('.', $parts)));
     }
     if (isset($parts)) {
         $_FILES['newfile']['name'] = implode('.', $parts);
     }
 }
开发者ID:lucasmilin,项目名称:filemanager-php-s3-plugin,代码行数:25,代码来源:filemanager.s3.class.php

示例3: die

 $conn = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD) or die("Error:Couldn't connect to server");
 $db = mysql_select_db(DB_DBNAME, $conn) or die("Error:Couldn't select database");
 $query = "SELECT * FROM users WHERE authToken = '{$authToken}'";
 $result = mysql_query($query) or die("Error:Query Failed-1");
 if (mysql_num_rows($result) == 1) {
     $row = mysql_fetch_array($result);
     $username = $row["email"];
     $region = $row["region"];
 } else {
     die("Error: Incorrect authToken");
 }
 mysql_close($conn);
 $newFileName = md5($username . $deviceID) . "_";
 $s3 = new AmazonS3();
 $bucket = 'com.sanchitkarve.tb.usor';
 $response = $s3->get_object_list($bucket);
 $userFiles = array();
 $foundFiles = false;
 foreach ($response as $item) {
     if (startsWith($item, $newFileName)) {
         $userfiles[] = $item;
         $foundFiles = true;
     }
 }
 // create cloudfront link if possible
 $urls = "";
 //print_r($response);
 if ($foundFiles) {
     foreach ($userfiles as $uitem) {
         $link = $s3->get_object_url($bucket, $uitem, '10 minutes');
         // replace domain with cloudfront and put them in urls
开发者ID:nikunjkacha,项目名称:ThalliumBackup-Cloud,代码行数:31,代码来源:download.php

示例4: exit

 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'sdk.class.php';
require_once 'include/book.inc.php';
// Create the S3 access object
$s3 = new AmazonS3();
if ($argc != 2) {
    exit("Usage: " . $argv[0] . " bucket name\n");
}
$bucket = $argv[1] == '-' ? BOOK_BUCKET : $argv[1];
// Retrieve array of al objects in bucket
$objects = $s3->get_object_list($bucket);
if ($objects) {
    foreach ($objects as $object) {
        print $object . "\n";
    }
} else {
    print "No objects found in " . $bucket . "\n";
}
exit(0);
开发者ID:websider,项目名称:amazon-web-services,代码行数:31,代码来源:list_bucket_objects.php

示例5: strtolower

    <input class="btn btn-success" style="clear: left; width: 100%; height: 32px; font-size: 13px;" type="submit" name="commit" value="Sign In" />
</form>
            </div>
            <? } ?>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>
        
        <?
        require_once './sdk.class.php';
        $s3 = new AmazonS3();
        $bucket = 'book-bucket-' . strtolower($s3->key);
        $fileList=$s3->get_object_list($bucket);
        
                  
  ?>
        <div id="showcase">
<!--            <div class="pull-right home">
                <a class="btn btn-small" href="#"><i class="icon-home pull-right "></i></a>
                </div>-->
            <div class="container fluid-grid">
                
                
                <?if(!isset($_SESSION['auth'])&&isset($_SESSION['msg'])){?>
                <div class="alert alert-error">
  <button type="button" class="close" data-dismiss="alert">×</button>
  <strong>Error!</strong>
  <? echo$_SESSION['msg'];?>
开发者ID:raveebhat,项目名称:BookPortal,代码行数:31,代码来源:index.php


注:本文中的AmazonS3::get_object_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。