簡體   English   中英

Amazon AWS s3使用圖像內容上傳 - PHP

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM