小编Jer*_*lom的帖子

使用Laravel 5.0 Storage Facade将元数据,标题(Expires,CacheControl)添加到上传到Amazon S3的文件中

我试图找出如何将元数据或标题(Expires,CacheControl等)添加到使用Laravel 5.0存储外观上传的文件中.我在这里使用这个页面作为参考.

http://laravel.com/docs/5.0/filesystem

以下代码正常工作:

Storage::disk('s3')->put('/test.txt', 'test');
Run Code Online (Sandbox Code Playgroud)

在挖掘之后我还发现有一个'visibility'参数可以将ACL设置为'public-read',因此以下内容也可以正常工作.

Storage::disk('s3')->put('/test.txt', 'test', 'public');
Run Code Online (Sandbox Code Playgroud)

但我希望能够为文件的标题设置一些其他值.我尝试过以下方法:

Storage::disk('s3')->put('/index4.txt', 'test', 'public', array('Expires'=>'Expires, Fri, 30 Oct 1998 14:19:41 GMT'));
Run Code Online (Sandbox Code Playgroud)

哪个不起作用,我也尝试过:

Storage::disk('s3')->put('/index4.txt', 'test', array('ACL'=>'public-read'));
Run Code Online (Sandbox Code Playgroud)

但是这会产生一个错误,其中'visibility'参数无法从字符串转换为数组.我检查了AwsS3Adapter的来源,似乎有选项代码,但我似乎无法看到如何正确传递它们.我认为它需要以下内容:

protected static $metaOptions = [
    'CacheControl',
    'Expires',
    'StorageClass',
    'ServerSideEncryption',
    'Metadata',
    'ACL',
    'ContentType',
    'ContentDisposition',
    'ContentLanguage',
    'ContentEncoding',
];
Run Code Online (Sandbox Code Playgroud)

任何有关如何实现这一点的帮助将不胜感激.

php amazon-s3 laravel-5 flysystem

22
推荐指数
3
解决办法
8917
查看次数

如何从Boto 3资源实例访问低级客户端?

例如,我有这个代码:

import boto3

ec2 = boto3.resource('ec2')

# Where is the client???
Run Code Online (Sandbox Code Playgroud)

我需要打电话boto3.client('ec2')还是有其他方式?

python amazon-web-services boto3

7
推荐指数
1
解决办法
3198
查看次数