Skip to main content
Skip table of contents

completeMultiPartUpload

This method is used to complete a multipart.
String completeMultiPartUpload(String awsLocation, String uploadId, List<String> eTagList)
Parameters:
awsLocation: The name of key to be uploaded as file location. You can get this value from the fileLocation of UploadRequestInfo object.
uploadId: The upload Id that you get this Id from the initializeMultipartUpload request as a return value.
eTagList: List of Etags. You can get Etags by copyPartMultiPart requests.
Return Value: The method will return the ETag as a String.
Example code:
String ETag = cg.SDriveTools.completeMultiPartUpload(uploadRequestInfos .fileLocation, uploadIdeTagList);

There may be issues with timing out before all the chunks are pieced back together. In that case, you can use the following workaround:

After the file chunks are uploaded, instead of calling the SDrive API or Salesforce to complete the task, the client should call AWS to complete the upload process.

Here is an example call:

let completeUploadResponse = await S3.completeMultipartUpload({
   Bucket: process.env.BUCKET,
   Key: "movie.mp4",
   MultipartUpload: {
   Parts: uploadPartResults
   },
   UploadId: multipartCreateResult.UploadId
}).promise()

This will use the S3 API to make this call. If you would like to use a direct HTTP POST, you can try the syntax in the following document from AWS:

https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.