我尝试了以下两个函数,它们都不起作用,它们可以将文件上传到S3,但是如果你从浏览器访问上传的文件,你可以看到它被视为application/octet-stream,那是不对的......
$s3->upload('mybucket', // bucket
$filename, // key
$imagebinarydata, // body
'public-read', // acl
array('contentType' => 'image/jpeg')); // options
Run Code Online (Sandbox Code Playgroud)
和
$s3->putObject(array(
'Bucket' => 'mybucket',
'Key' => $filename,
'ACL' => 'public-read',
'contentType' => 'image/jpeg',
'Body' => $imagebinarydata));
Run Code Online (Sandbox Code Playgroud)
我正在使用最新的AWS.PHAR
您需要使用大写字母ContentType,putObject如文档中所述:
'ContentType' => 'image/jpeg'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1680 次 |
| 最近记录: |