InitiateMultipartUploadAsync() public method

Initiates the asynchronous execution of the InitiateMultipartUpload operation.
public InitiateMultipartUploadAsync ( InitiateMultipartUploadRequest request, System cancellationToken = default(CancellationToken) ) : Task
request InitiateMultipartUploadRequest Container for the necessary parameters to execute the InitiateMultipartUpload operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
Ejemplo n.º 1
0
        public AmazonMultiUpload(AmazonS3Client client, string bucket, string key, Metadata metadata, CancellationToken ct)
        {
            _client = client;
            _bucket = bucket;
            _key = key;
            _blocks = new List<Task<UploadPartResponse>>();
            _ct = ct;

            // Fire up the multipart upload request...
            var req = new InitiateMultipartUploadRequest { BucketName = _bucket, Key = key };
            if (metadata != null)
            {
                foreach (var m in metadata)
                {
                    req.Metadata.Add("x-amz-meta-" + m.Key, m.Value);
                }
            }

            _uploadId = _client.InitiateMultipartUploadAsync(req, _ct).ContinueWith(r => r.Result.UploadId);
        }