Table of Contents

Class PresignedPostRequest

Namespace
Cloudflare.NET.R2.Models
Assembly
Cloudflare.NET.R2.dll

Defines the parameters for creating a presigned POST URL for browser-based uploads.

public record PresignedPostRequest : IEquatable<PresignedPostRequest>
Inheritance
PresignedPostRequest
Implements
Inherited Members

Constructors

PresignedPostRequest(string, TimeSpan, string?, (long Min, long Max)?, IEnumerable<S3PostCondition>?, IReadOnlyDictionary<string, string>?)

Defines the parameters for creating a presigned POST URL for browser-based uploads.

public PresignedPostRequest(string Key, TimeSpan ExpiresAfter, string? ContentType = null, (long Min, long Max)? ContentLengthRange = null, IEnumerable<S3PostCondition>? Conditions = null, IReadOnlyDictionary<string, string>? HeadersToSign = null)

Parameters

Key string

The object key (path) where the file will be stored in the bucket.

ExpiresAfter TimeSpan

The duration for which the presigned URL will be valid.

ContentType string

An optional but recommended condition to enforce the MIME type of the uploaded file (e.g., "image/jpeg").

ContentLengthRange (long Min, long Max)?

An optional but recommended condition to enforce the minimum and maximum size of the uploaded file in bytes.

Conditions IEnumerable<S3PostCondition>

An optional collection of custom S3 Post conditions to include in the policy, allowing for advanced validation scenarios.

HeadersToSign IReadOnlyDictionary<string, string>

An optional dictionary of headers to include in the policy, enforcing them on the client-side upload. For POST, these are added as fields in the policy document.

Properties

Conditions

An optional collection of custom S3 Post conditions to include in the policy, allowing for advanced validation scenarios.

public IEnumerable<S3PostCondition>? Conditions { get; init; }

Property Value

IEnumerable<S3PostCondition>

ContentLengthRange

An optional but recommended condition to enforce the minimum and maximum size of the uploaded file in bytes.

public (long Min, long Max)? ContentLengthRange { get; init; }

Property Value

(long Min, long Max)?

ContentType

An optional but recommended condition to enforce the MIME type of the uploaded file (e.g., "image/jpeg").

public string? ContentType { get; init; }

Property Value

string

ExpiresAfter

The duration for which the presigned URL will be valid.

public TimeSpan ExpiresAfter { get; init; }

Property Value

TimeSpan

HeadersToSign

An optional dictionary of headers to include in the policy, enforcing them on the client-side upload. For POST, these are added as fields in the policy document.

public IReadOnlyDictionary<string, string>? HeadersToSign { get; init; }

Property Value

IReadOnlyDictionary<string, string>

Key

The object key (path) where the file will be stored in the bucket.

public string Key { get; init; }

Property Value

string