[英]Amazon AWS s3 upload using image content - PHP
我使用以下代码将图像上载到ECS server
。 在这里,我首先将图像存储到临时位置,然后将其上传到服务器。
$result = $s3->putObject(array(
'Bucket' => $this->bucket,
'SourceFile' => $temp,
'Key' => $Destination_folder,
'ACL' => 'public-read',
'ContentType' => 'text/plain',
'Expires' => $expire
));
我想删除这个临时位置的使用。 那么有没有办法直接使用图像内容上传图像。
尝试使用s3 putObject的“Body”作为图像内容。
$result = $s3->putObject(array(
'Bucket' => $this->bucket,
'Key' => $Destination_folder,
'Body' => $image_content
));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.