AWSの説明ページ
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/dev/mpuoverview.html
最少パートサイズ 5MB
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/dev/qfacts.html
AWS-SDKで試してみたが、やっぱり駄目みたい。
AWS HTTP error: Client error: 400 EntityTooSmall (client): Your proposed upload is smaller than the minimum allowed size –
<Error>
<Code>EntityTooSmall</Code>
<Message>Your proposed upload is smaller than the minimum allowed size</Message>
<ProposedSize>4194304</ProposedSize>
<MinSizeAllowed>5242880</MinSizeAllowed>
<PartNumber>1</PartNumber>
<ETag>xxx</ETag>
<RequestId>xxx</RequestId>
<HostId>xxx=</HostId>
</Error>’
PHP + CURLは、MultipartUploadがなぜだかそもそもうまくいってない。
<?xml version=”1.0″ encoding=”UTF-8″?>
<Error>
<Code>RequestTimeout</Code>
<Message>Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.</Message>
<RequestId>xxx</RequestId>
<HostId>xxx</HostId>
</Error>
★アップロード順番は順不同でも、completeMultipartUploadに渡す順序を正しく渡せばOK
$parts = array();
$partNumber = 2;
$file = fopen(‘awssdk-5MB-2’, ‘r’);
$result = $s3->uploadPart(array(
‘Bucket’ => $bucket,
‘Key’ => $keyname,
‘UploadId’ => $uploadId,
‘PartNumber’ => $partNumber,
‘Body’ => fread($file, 10 * 1024 * 1024),
));
fclose($file);
$parts[] = array(
‘PartNumber’ => $partNumber,
‘ETag’ => $result[‘ETag’],
);
$file = fopen(‘awssdk-5MB-1’, ‘r’);
$partNumber = 1;
$result = $s3->uploadPart(array(
‘Bucket’ => $bucket,
‘Key’ => $keyname,
‘UploadId’ => $uploadId,
‘PartNumber’ => $partNumber,
‘Body’ => fread($file, 10 * 1024 * 1024),
));
fclose($file);
$parts[] = array(
‘PartNumber’ => $partNumber,
‘ETag’ => $result[‘ETag’],
);
$parts = array_reverse($parts);