Overview
This topic describes how to set policies for POST requests in OSS.
Background information
Please refer to the PostObject documentation for setting rules for policies. For more information about POST request policies, see the following common examples.
- Restricted upload objects must start with "upload /".
{ "expiration": "2014-12-01T12:00:00.000Z", "conditions": [ { "bucket": "" }, [ "starts-with", "[$Key]", "upload/" ] ] }NoteNote:[$Key] is the key of Ojbect.
- The name of the object to be uploaded. Set the value to "upload/[$File_Name]".
Note
Note:[$File_Name] is the upload file name.
{ "expiration": "2120-01-01T12:00:00.000Z", "conditions": [ { "bucket": "*" }, [ "eq", "[$Key]", "upload/[$File_Name]" ] ] } - Limit the size of uploaded objects.
{ "expiration": "2120-01-01T12:00:00.000Z", "conditions": [ [ "content-length-range", 0, 104857600 ] ] }
Applicable scope
- Object Storage Service (OSS)