php - How to update object properties in a AWS S3 Bucket -
i've uploaded 25k files (large media files) s3 bucket. used aws sdk2 php (s3client::putobject
) perform uploads. now, need update metadata these files i.e change contentdisposition attachment , assign filename.
is there way perform without requiring re-upload file? please help.
yes, can use copyobject method, set copysource
parameter equal bucket
, key
parameters.
example:
// setup $s3 connection, , define bucket , key resource. $s3->copyobject(array( 'bucket' => $bucket, 'copysource' => "$bucket/$key", 'key' => $key, 'metadata' => array( 'extraheader' => 'header value' ), 'metadatadirective' => 'replace' ));