-
Hi, I refer to this document https://docs.min.io/docs/how-to-use-aws-sdk-for-php-with-minio-server.html to use php sdk.
And my code is : function __construct($Endpoint = MINIO_ENDPOINT, $Key = MINIO_KEY, $Secret = MINIO_SECRET, $Bucket = MINIO_BUCKET) {
$this->s3 = new Aws\S3\S3Client([
'version' => 'latest',
'endpoint' => $Endpoint,
'region' => 'us-east-1',
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $Key,
'secret' => $Secret,
],
]);
$this->bucket = $Bucket;
}
public function get_presigned_url($name) {
$command = $this->s3->getCommand('GetObject', [
'Bucket' => $this->bucket,
'Key' => $name,
]);
// Create a pre-signed URL for a request with duration of 10 miniutes
$presignedRequest = $this->s3->createPresignedRequest($command, '+10 minutes');
// Get the actual presigned-url
$presignedUrl = (string) $presignedRequest->getUri();
return $presignedUrl;
} The presigned url i generate is:
|
Beta Was this translation helpful? Give feedback.
Answered by
120318
Jul 21, 2021
Replies: 1 comment
-
I got it, I should use PutObject. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
120318
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got it, I should use PutObject.