本文整理汇总了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);
}
示例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);
}
示例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;
}