Skip to content

Instantly share code, notes, and snippets.

@setu1421
Created April 6, 2019 07:32
Show Gist options
  • Save setu1421/36216700b7fc91e8d4292dca449bb62d to your computer and use it in GitHub Desktop.
Save setu1421/36216700b7fc91e8d4292dca449bb62d to your computer and use it in GitHub Desktop.
Build and send the multipart complete request
//Step 3: build and send the multipart complete request
if (lastPart)
{
eTags.Add(new PartETag
{
PartNumber = partNumber,
ETag = uploadResponse.ETag
});
var completeRequest = new CompleteMultipartUploadRequest
{
BucketName = bucketName,
Key = fileName,
UploadId = uploadId,
PartETags = eTags
};
var result = _s3Client.CompleteMultipartUpload(completeRequest);
//Set the uploadId and fileURLs with the response.
response = uploadRequest.UploadId + "|success|" + result.Location + "|";
//For image get thumbnail url
if (HasImageExtension(fileName.ToLower()))
{
//Send the Thumbnail URL
response += result.Location.Replace(uploadRequest.Key, "thumbnail/" + uploadRequest.Key);
} else
{
response += "";
}
}
else
{
eTags.Add(new PartETag
{
PartNumber = partNumber,
ETag = uploadResponse.ETag
});
//Set the uploadId and eTags with the response
response = uploadRequest.UploadId + "|" + GetAllETags(eTags);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment