Configure metadata for S3 multi-page download

I would like to upload a file to S3 in parts and set some metadata in the file. I use boto to interact with S3. I can set metadata with unidirectional downloads, for example:

Is there a way to set metadata with multi-page loading? I tried this method to copy a key to change metadata, but it does not work with an error:InvalidRequest: The specified copy source is larger than the maximum allowable size for a copy source: <size>

I also tried the following:

key = bucket.create_key(key_name)
key.set_metadata('some-key', 'value')
<multipart upload>

... but multi-page loading overwrites metadata.

I use code similar to this for multi-page loading.

+4
source share
2 answers

, :

Per :

, , .

, boto initiate_multipart_upload. .

+2

, , . , , .

        $uploader = new MultipartUploader($client, $source, [
        'bucket' => $bucketName,
        'key' => $filename,
        'before_initiate' => function (\Aws\Command $command) {
            $command['ContentType'] = 'application/octet-stream';
            $command['ContentDisposition'] = 'attachment';
        },
    ]);

, https://docs.aws.amazon.com/aws-sdk-php/v3/guide/service/s3-multipart-upload.html#customizing-a-multipart-upload , .

, .

+2

All Articles