Class UploadPartRequest
Container for the parameters to the UploadPart operation. Uploads a part in a multipart upload.
note
In this operation, you provide part data in your request. However, you have an option to specify your existing Amazon S3 object as a data source for the part you are uploading. To upload a part from an existing object, you use the UploadPartCopy operation.
You must initiate a multipart upload (see CreateMultipartUpload) before you can upload any part. In response to your initiate request, Amazon S3 returns an upload ID, a unique identifier, that you must include in your upload part request.
Part numbers can be any number from 1 to 10,000, inclusive. A part number uniquely identifies a part and also defines its position within the object being created. If you upload a new part using the same part number that was used with a previous part, the previously uploaded part is overwritten.
For information about maximum and minimum part sizes and other multipart upload specifications, see Multipart upload limits in the Amazon S3 User Guide.
To ensure that data is not corrupted when traversing the network, specify the
Content-MD5
header in the upload part request. Amazon S3 checks the part data against the provided
MD5 value. If they do not match, Amazon S3 returns an error.
If the upload request is signed with Signature Version 4, then Amazon Web Services S3 uses the
x-amz-content-sha256
header as a checksum instead of Content-MD5
.
For more information see Authenticating
Requests: Using the Authorization Header (Amazon Web Services Signature Version 4).
Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.
For more information on multipart uploads, go to Multipart Upload Overview in the Amazon S3 User Guide .
For information on the permissions required to use the multipart upload API, go to Multipart Upload and Permissions in the Amazon S3 User Guide.
You can optionally request server-side encryption where Amazon S3 encrypts your data as it writes it to disks in its data centers and decrypts it for you when you access it. You have the option of providing your own encryption key, or you can use the Amazon Web Services managed encryption keys. If you choose to provide your own encryption key, the request headers you provide in the request must match the headers you used in the request to initiate the upload by using CreateMultipartUpload. For more information, go to Using Server-Side Encryption in the Amazon S3 User Guide.
Server-side encryption is supported by the S3 Multipart Upload actions. Unless you are using a customer-provided encryption key, you don't need to specify the encryption parameters in each UploadPart request. Instead, you only need to specify the server-side encryption parameters in the initial Initiate Multipart request. For more information, see CreateMultipartUpload.
If you requested server-side encryption using a customer-provided encryption key in your initiate multipart upload request, you must provide identical encryption information in each part upload using the following headers.
x-amz-server-side-encryption-customer-algorithm
x-amz-server-side-encryption-customer-key
x-amz-server-side-encryption-customer-key-MD5
Special Errors
Code: NoSuchUpload
Cause: The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.
HTTP Status Code: 404 Not Found
SOAP Fault Code Prefix: Client
Related Resources
public class UploadPartRequest : AmazonWebServiceRequest
- Inheritance
-
UploadPartRequest
Remarks
If PartSize is not specified then the rest of the content from the file or stream will be sent to Amazon S3.
You must set either the FilePath or InputStream. If FilePath is set then the FilePosition property must be set.
Constructors
UploadPartRequest()
public UploadPartRequest()
Properties
BucketName
Gets and sets the property BucketName.
The name of the bucket to which the multipart upload was initiated.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action with S3 on Outposts through the Amazon Web Services SDKs,
you provide the Outposts access point ARN in place of the bucket name. For more information
about S3 on Outposts ARNs, see What
is S3 on Outposts in the Amazon S3 User Guide.
public string BucketName { get; set; }
Property Value
CalculateContentMD5Header
Gets or sets whether the Content-MD5 header should be calculated for upload.
public bool CalculateContentMD5Header { get; set; }
Property Value
ChecksumAlgorithm
Gets and sets the property ChecksumAlgorithm.
Indicates the algorithm used to create the checksum for the object. Amazon S3 will fail the request with a 400 error if there is no checksum associated with the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 will ignore any provided
ChecksumAlgorithm
.
public ChecksumAlgorithm ChecksumAlgorithm { get; set; }
Property Value
ChecksumCRC32
Gets and sets the property ChecksumCRC32.
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This specifies the base64-encoded, 32-bit CRC32 checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
public string ChecksumCRC32 { get; set; }
Property Value
ChecksumCRC32C
Gets and sets the property ChecksumCRC32C.
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This specifies the base64-encoded, 32-bit CRC32C checksum of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
public string ChecksumCRC32C { get; set; }
Property Value
ChecksumSHA1
Gets and sets the property ChecksumSHA1.
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This specifies the base64-encoded, 160-bit SHA-1 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
public string ChecksumSHA1 { get; set; }
Property Value
ChecksumSHA256
Gets and sets the property ChecksumSHA256.
This header can be used as a data integrity check to verify that the data received is the same data that was originally sent. This specifies the base64-encoded, 256-bit SHA-256 digest of the object. For more information, see Checking object integrity in the Amazon S3 User Guide.
public string ChecksumSHA256 { get; set; }
Property Value
DisableMD5Stream
WARNING: Setting DisableMD5Stream to true disables the MD5 data integrity check on this request.
When true, MD5Stream will not be used in the upload request. This may increase upload performance under high CPU loads. The default value is null. When null, the AWSConfigsS3.DisableMD5Stream property value will be used.
MD5Stream, SigV4 payload signing, and HTTPS each provide some data integrity verification. If DisableMD5Stream is true and DisablePayloadSigning is true, then the possibility of data corruption is completely dependant on HTTPS being the only remaining source of data integrity verification.
public bool? DisableMD5Stream { get; set; }
Property Value
- bool?
DisablePayloadSigning
WARNING: Setting DisablePayloadSigning to true disables the SigV4 payload signing data integrity check on this request.
If using SigV4, the DisablePayloadSigning flag controls if the payload should be signed on a request by request basis. By default this flag is null which will use the default client behavior. The default client behavior is to sign the payload. When DisablePayloadSigning is true, the request will be signed with an UNSIGNED-PAYLOAD value. Setting DisablePayloadSigning to true requires that the request is sent over a HTTPS connection.
Under certain circumstances, such as uploading to S3 while using MD5 hashing, it may be desireable to use UNSIGNED-PAYLOAD to decrease signing CPU usage. This flag only applies to Amazon S3 PutObject and UploadPart requests.
MD5Stream, SigV4 payload signing, and HTTPS each provide some data integrity verification. If DisableMD5Stream is true and DisablePayloadSigning is true, then the possibility of data corruption is completely dependant on HTTPS being the only remaining source of data integrity verification.
public bool? DisablePayloadSigning { get; set; }
Property Value
- bool?
Expect100Continue
Overriden to turn on Expect 100 continue.
protected override bool Expect100Continue { get; }
Property Value
ExpectedBucketOwner
Gets and sets the property ExpectedBucketOwner.
The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP
403 (Access Denied)
error.
public string ExpectedBucketOwner { get; set; }
Property Value
FilePath
Full path and name of a file from which the content for the part is retrieved.
For WinRT and Windows Phone this property must be in the form of "ms-appdata:///local/file.txt".
public string FilePath { get; set; }
Property Value
FilePosition
Position in the file specified by FilePath from which to retrieve the content of the part. This field is required when a file path is specified. It is ignored when using the InputStream property.
public long FilePosition { get; set; }
Property Value
IncludeSHA256Header
Overriden to turn off sending SHA256 header.
protected override bool IncludeSHA256Header { get; }
Property Value
InputStream
Input stream for the request; content for the request will be read from the stream.
public Stream InputStream { get; set; }
Property Value
IsLastPart
Caller needs to set this to true when uploading the last part. This property only needs to be set when using the AmazonS3EncryptionClient.
public bool IsLastPart { get; set; }
Property Value
Key
The key of the object.
public string Key { get; set; }
Property Value
Remarks
This property will be used as part of the resource path of the HTTP request. In .NET the System.Uri class is used to construct the uri for the request. The System.Uri class will canonicalize the uri string by compacting characters like "..". /// For example an object key of "foo/../bar/file.txt" will be transformed into "bar/file.txt" because the ".." is interpreted as use parent directory. For further information view the documentation for the Uri class: https://docs.microsoft.com/en-us/dotnet/api/system.uri
MD5Digest
An MD5 digest for the part.
public string MD5Digest { get; set; }
Property Value
PartNumber
Gets and sets the property PartNumber.
Part number of part being uploaded. This is a positive integer between 1 and 10,000.
public int PartNumber { get; set; }
Property Value
PartSize
The size of the part to be uploaded.
public long PartSize { get; set; }
Property Value
RequestPayer
Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests.
public RequestPayer RequestPayer { get; set; }
Property Value
ServerSideEncryptionCustomerMethod
The Server-side encryption algorithm to be used with the customer provided key.
Specifies the algorithm to use to when encrypting the object (for example, AES256).
public ServerSideEncryptionCustomerMethod ServerSideEncryptionCustomerMethod { get; set; }
Property Value
ServerSideEncryptionCustomerProvidedKey
The base64-encoded encryption key for Amazon S3 to use to encrypt the object
Using the encryption key you provide as part of your request Amazon S3 manages both the encryption, as it writes to disks, and decryption, when you access your objects. Therefore, you don't need to maintain any data encryption code. The only thing you do is manage the encryption keys you provide.
When you retrieve an object, you must provide the same encryption key as part of your request. Amazon S3 first verifies the encryption key you provided matches, and then decrypts the object before returning the object data to you.
Important: Amazon S3 does not store the encryption key you provide.
public string ServerSideEncryptionCustomerProvidedKey { get; set; }
Property Value
ServerSideEncryptionCustomerProvidedKeyMD5
The MD5 of the customer encryption key specified in the ServerSideEncryptionCustomerProvidedKey property. The MD5 is base 64 encoded. This field is optional, the SDK will calculate the MD5 if this is not set.
public string ServerSideEncryptionCustomerProvidedKeyMD5 { get; set; }
Property Value
StreamTransferProgress
Attach a callback that will be called as data is being sent to the AWS Service.
public EventHandler<StreamTransferProgressArgs> StreamTransferProgress { get; set; }
Property Value
- EventHandler<StreamTransferProgressArgs>
UploadId
Upload ID identifying the multipart upload whose part is being uploaded.
public string UploadId { get; set; }
Property Value
UseChunkEncoding
If this value is set to true then a chunked encoding upload will be used for the request. Default: true.
public bool UseChunkEncoding { get; set; }