AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Creates a starts-with condition that requires a form field value to begin with the specified prefix.
Namespace: Amazon.S3.Model
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z
public StartsWithCondition StartsWith(
String fieldName,
String prefix
)
The name of the form field whose value must start with the specified prefix. The most common field is "key" for restricting object key prefixes, but any form field can be used.
The prefix that the form field value must start with. Can be an empty string to allow any value (though this makes the condition effectively permissive).
Exception | Condition |
---|---|
System.ArgumentNullException | Thrown when or is null. |
System.ArgumentException | Thrown when is empty. |
// Only allow uploads to the "user-uploads/" prefix var keyCondition = S3PostCondition.StartsWith("key", "user-uploads/"); // Restrict uploads to a specific user's folder var userCondition = S3PostCondition.StartsWith("key", $"users/{userId}/");
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer