Class PresignedPutRequest
- Namespace
- Cloudflare.NET.R2.Models
- Assembly
- Cloudflare.NET.R2.dll
Defines the parameters for creating a presigned PUT URL, which allows for direct, secure uploads.
public record PresignedPutRequest : IEquatable<PresignedPutRequest>
- Inheritance
-
PresignedPutRequest
- Implements
- Inherited Members
Constructors
PresignedPutRequest(string, TimeSpan, long, string, IEnumerable<S3PostCondition>?, IReadOnlyDictionary<string, string>?, UploadChecksum?, string?)
Defines the parameters for creating a presigned PUT URL, which allows for direct, secure uploads.
public PresignedPutRequest(string Key, TimeSpan ExpiresAfter, long ContentLength, string ContentType, IEnumerable<S3PostCondition>? Conditions = null, IReadOnlyDictionary<string, string>? HeadersToSign = null, UploadChecksum? Checksum = null, string? CacheControl = null)
Parameters
KeystringThe object key (path) where the file will be stored in the bucket.
ExpiresAfterTimeSpanThe duration for which the presigned URL will be valid.
ContentLengthlongThe exact size of the file to be uploaded, in bytes. This is enforced by R2.
ContentTypestringThe MIME type of the file to be uploaded (e.g., "image/jpeg"). This is enforced by R2.
ConditionsIEnumerable<S3PostCondition>Optional S3 POST policy conditions to enforce additional constraints on the upload.
HeadersToSignIReadOnlyDictionary<string, string>An optional dictionary of additional headers to include in the signature, enforcing them on the client-side upload.
ChecksumUploadChecksumAn optional digest to bind the uploaded bytes to. Its algorithm's header is signed into the URL, the client must send it, and R2 rejects the upload with 400
BadDigest(storing nothing) when the arriving bytes do not hash to the stated digest. All five R2ChecksumAlgorithm values are verified on a single-part PUT. When the same header also appears inHeadersToSign, this parameter wins.CacheControlstringAn optional
Cache-Controlvalue to store on the object. The header is signed into the URL, so the client must send it with exactly this value or R2 answers 403; R2 persists the stored value and serves it on every GET, which drives edge and browser caching. Passing null or a blank string leaves the header unset. When the same header also appears inHeadersToSign, this parameter wins.
Properties
CacheControl
An optional Cache-Control value to store on the object. The header is signed into the URL, so the
client must send it with exactly this value or R2 answers 403; R2 persists the stored value and serves it on
every GET, which drives edge and browser caching. Passing null or a blank string leaves
the header unset. When the same header also appears in HeadersToSign, this parameter
wins.
public string? CacheControl { get; init; }
Property Value
Checksum
An optional digest to bind the uploaded bytes to. Its algorithm's header is signed into the URL, the client
must send it, and R2 rejects the upload with 400 BadDigest (storing nothing) when the arriving bytes
do not hash to the stated digest. All five R2ChecksumAlgorithm values are verified on a
single-part PUT. When the same header also appears in HeadersToSign, this parameter wins.
public UploadChecksum? Checksum { get; init; }
Property Value
Conditions
Optional S3 POST policy conditions to enforce additional constraints on the upload.
public IEnumerable<S3PostCondition>? Conditions { get; init; }
Property Value
ContentLength
The exact size of the file to be uploaded, in bytes. This is enforced by R2.
public long ContentLength { get; init; }
Property Value
ContentType
The MIME type of the file to be uploaded (e.g., "image/jpeg"). This is enforced by R2.
public string ContentType { get; init; }
Property Value
ExpiresAfter
The duration for which the presigned URL will be valid.
public TimeSpan ExpiresAfter { get; init; }
Property Value
HeadersToSign
An optional dictionary of additional headers to include in the signature, enforcing them on the client-side upload.
public IReadOnlyDictionary<string, string>? HeadersToSign { get; init; }
Property Value
Key
The object key (path) where the file will be stored in the bucket.
public string Key { get; init; }