我使用以下代码将图像上传到ECS server.在这里,我首先将图像存储到临时位置,然后将其上传到服务器.
$result = $s3->putObject(array(
'Bucket' => $this->bucket,
'SourceFile' => $temp,
'Key' => $Destination_folder,
'ACL' => 'public-read',
'ContentType' => 'text/plain',
'Expires' => $expire
));
Run Code Online (Sandbox Code Playgroud)
我想删除这个临时位置的使用.那么有没有办法直接使用图像内容上传图像.
尝试使用s3 putObject的"Body"作为图像内容.
$result = $s3->putObject(array(
'Bucket' => $this->bucket,
'Key' => $Destination_folder,
'Body' => $image_content
));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
73 次 |
| 最近记录: |