This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 3: build and send the multipart complete request | |
if (lastPart) | |
{ | |
eTags.Add(new PartETag | |
{ | |
PartNumber = partNumber, | |
ETag = uploadResponse.ETag | |
}); | |
var completeRequest = new CompleteMultipartUploadRequest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 2: upload each chunk (this will run for every chunk unlike the other steps which are run once) | |
var uploadRequest = new UploadPartRequest | |
{ | |
BucketName = bucketName, | |
Key = fileName, | |
UploadId = uploadId, | |
PartNumber = partNumber, | |
InputStream = ms, | |
IsLastPart = lastPart, | |
PartSize = ms.Length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 1: build and send a multi upload request | |
if (chunkIndex == 0) | |
{ | |
var initiateRequest = new InitiateMultipartUploadRequest | |
{ | |
BucketName = bucketName, | |
Key = fileName | |
}; | |
var initResponse = _s3Client.InitiateMultipartUpload(initiateRequest); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UploadUtilityHelper | |
{ | |
private readonly string bucketName = ConfigurationManager.AppSettings["BucketName"]; | |
private static readonly RegionEndpoint bucketRegion = RegionEndpoint.USEast1; | |
public string UploadChunk(string fileName, string uploadId, int chunkIndex, int chunkMax, Stream stream, string prevETags) | |
{ | |
var response = ""; | |
try |