PutObject into directory Amazon s3 / PHP

前端 未结 3 968
没有蜡笔的小新
没有蜡笔的小新 2021-01-04 00:13

I need to upload my files inside specific directories that I created on my amazon s3 storage. I always uploaded the files on the \"absolute path\" of my bucket doing somethi

3条回答
  •  抹茶落季
    2021-01-04 00:55

    Updated code according to the latest SDK of AWS:-

    $result = $s3->putObject(array(
        'Bucket' => 'bucket name of S3',
        'Key' => 'pawan-trying',
        'SourceFile' => 'local image path or document root image path ',
        'ContentType' => 'image',
        'ACL' => 'public-read',
        'StorageClass' => 'REDUCED_REDUNDANCY',
        'Metadata' => array(
            'param1' => 'value 1',
            'param2' => 'value 2'
        )
            ));
    

提交回复
热议问题