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


PHP Zend_Service_Amazon_S3::putFileStream方法代码示例

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


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

示例1: store

 /**
  * Move a local file to S3 storage.
  *
  * @param string $source Local filesystem path to file.
  * @param string $dest Destination path.
  */
 public function store($source, $dest)
 {
     $objectName = $this->_getObjectName($dest);
     // If an expiration time is set, we're uploading private files
     // and using signed URLs. If not, we're uploading public files.
     if ($this->_getExpiration()) {
         $meta[Zend_Service_Amazon_S3::S3_ACL_HEADER] = Zend_Service_Amazon_S3::S3_ACL_PRIVATE;
     } else {
         $meta[Zend_Service_Amazon_S3::S3_ACL_HEADER] = Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ;
     }
     $status = $this->_s3->putFileStream($source, $objectName, $meta);
     if (!$status) {
         throw new Omeka_Storage_Exception('Unable to store file.');
     }
     _log("Omeka_Storage_Adapter_ZendS3: Stored '{$source}' as '{$objectName}'.");
     unlink($source);
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:23,代码来源:ZendS3.php

示例2: _fileTest

 protected function _fileTest($filename, $object, $type, $exp_type, $stream = false)
 {
     if ($stream) {
         $this->_amazon->putFile($filename, $object, array(S3\S3::S3_CONTENT_TYPE_HEADER => $type));
     } else {
         $this->_amazon->putFileStream($filename, $object, array(S3\S3::S3_CONTENT_TYPE_HEADER => $type));
     }
     $data = file_get_contents($filename);
     $this->assertTrue($this->_amazon->isObjectAvailable($object));
     $info = $this->_amazon->getInfo($object);
     $this->assertEquals('"' . md5_file($filename) . '"', $info["etag"]);
     $this->assertEquals(filesize($filename), $info["size"]);
     $this->assertEquals($exp_type, $info["type"]);
     $fdata = $this->_amazon->getObject($object);
     $this->assertEquals($data, $fdata);
 }
开发者ID:navassouza,项目名称:zf2,代码行数:16,代码来源:OnlineTest.php

示例3: s3_put_file

function s3_put_file($access_key_id, $secret_access_key, $bucket_path, $file_path, $mime)
{
    $result = FALSE;
    if ($access_key_id && $secret_access_key && $bucket_path && $file_path) {
        try {
            $s3 = new Zend_Service_Amazon_S3($access_key_id, $secret_access_key);
            $meta = array();
            $meta[Zend_Service_Amazon_S3::S3_ACL_HEADER] = Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ;
            if ($mime) {
                $meta[Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER] = $mime;
            }
            if ($s3->putFileStream($file_path, $bucket_path, $meta)) {
                $result = TRUE;
            }
        } catch (Exception $ex) {
            //print $ex->getMessage();
        }
    }
    return $result;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:20,代码来源:s3utils.php


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