是否可以将小于 5 MB 的部分上传到 Amazon S3?

Is it possible to upload to Amazon S3 with part less then 5 MB?

是否可以将小于 5 MB 的部分上传到 Amazon s3?

我现在正在使用 Android 客户端,但我认为这并不重要。

我正在尝试将文件 Android 分段上传到 Amazon S3。

我希望这些部分小于 5MB(例如 1MB),但我不能。

编辑:

// Step 1: Initialize.
                InitiateMultipartUploadRequest initRequest = new
                        InitiateMultipartUploadRequest(existingBucketName, keyName);
                InitiateMultipartUploadResult initResponse = s3.initiateMultipartUpload(initRequest);

                File file = new File(filePath);
                long contentLength = file.length();
                long partSize = 15 * 1024 * 1024; // Set part size to ~ 1 MB.

                try {
                    // Step 2: Upload parts.
                    long filePosition = 0;
                    for (int i = 1; filePosition < contentLength; i++) {
                        // Last part can be less than 5 MB. Adjust part size.
                        partSize = Math.min(partSize, (contentLength - filePosition));

                        // Create request to upload a part.

                        UploadPartRequest uploadRequest = new UploadPartRequest()
                                .withBucketName(existingBucketName).withKey(keyName)
                                .withUploadId(initResponse.getUploadId()).withPartNumber(i)
                                .withFileOffset(filePosition)
                                .withFile(file)
                                .withPartSize(partSize);

根据AWS documentation"each part must be at least 5 MB in size, except the last part"