SetKeyStartsWith - Sets an object name that an policy based upload can start with. Can use an empty value ("") to allow any key.
(keyStartsWith string)
| 104 | // can start with. |
| 105 | // Can use an empty value ("") to allow any key. |
| 106 | func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error { |
| 107 | policyCond := policyCondition{ |
| 108 | matchType: "starts-with", |
| 109 | condition: "$key", |
| 110 | value: keyStartsWith, |
| 111 | } |
| 112 | if err := p.addNewPolicy(policyCond); err != nil { |
| 113 | return err |
| 114 | } |
| 115 | p.formData["key"] = keyStartsWith |
| 116 | return nil |
| 117 | } |
| 118 | |
| 119 | // SetBucket - Sets bucket at which objects will be uploaded to. |
| 120 | func (p *PostPolicy) SetBucket(bucketName string) error { |