doc-exports/docs/obs/api-ref/obs_04_0012.html
zhangyue 8ba86cabc9 OBS API DOC
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2024-05-28 10:01:19 +00:00

330 lines
29 KiB
HTML

<a name="obs_04_0012"></a><a name="obs_04_0012"></a>
<h1 class="topictitle1">Authentication of Signature Carried in the Table Uploaded Through a Browser</h1>
<div id="body1523611911872"><p id="obs_04_0012__p56208005173927">OBS supports browser-based object upload using the POST method. Signatures of such requests are uploaded in tables. First, create a security policy and specify the requirements in the request, for example, bucket name and object name prefix. Then, create a signature based on this policy. The request form to be signed must contain valid signature and policy. Finally, create a table to upload the object to the bucket.</p>
<p id="obs_04_0012__p43211767104750">The process of calculating a signature is as follows:</p>
<ol id="obs_04_0012__ol824835510489"><li id="obs_04_0012__li13246145519488"><a name="obs_04_0012__li13246145519488"></a><a name="li13246145519488"></a>Encode the policy content in UTF-8.</li><li id="obs_04_0012__li1160858144812"><a name="obs_04_0012__li1160858144812"></a><a name="li1160858144812"></a>Encode the result of <a href="#obs_04_0012__li13246145519488">1</a> in Base64.</li><li id="obs_04_0012__li207269014915"><a name="obs_04_0012__li207269014915"></a><a name="li207269014915"></a>Use the SK to calculate the HMAC-SHA1 signature on the result of <a href="#obs_04_0012__li1160858144812">2</a>.</li><li id="obs_04_0012__li257072134920">Encode the result of <a href="#obs_04_0012__li207269014915">3</a> in Base64 to obtain the signature.</li></ol>
<pre class="screen" id="obs_04_0012__screen5989837711856">StringToSign = Base64( UTF-8-Encoding-Of( policy ) )
Signature = Base64( HMAC-SHA1( YourSecretAccessKeyID, StringToSign ) )</pre>
<div class="p" id="obs_04_0012__p5741530311850">The content of the policy is as follows:<pre class="screen" id="obs_04_0012__screen43388816111050">{ "expiration": "2017-12-31T12:00:00.000Z",
"conditions": [
{"x-obs-acl": "public-read" },
{"<span style="color:#3D3F43;">x-obs-security-token</span>": "YwkaRTbdY8g7q...." },
{"bucket": "book" },
["starts-with", "$key", "user/"]
]
}</pre>
</div>
<p id="obs_04_0012__p19975301111035">The policy contains the validity period (see <a href="#obs_04_0012__section6158671218">Expiration</a>) and conditions (see <a href="#obs_04_0012__section675581585817">Conditions</a>).</p>
<div class="section" id="obs_04_0012__section6158671218"><a name="obs_04_0012__section6158671218"></a><a name="section6158671218"></a><h4 class="sectiontitle">Expiration</h4><p id="obs_04_0012__p127221456581">The <strong id="obs_04_0012__b12265203582">expiration</strong> field describes when the signature will expire, which is expressed in the format according to ISO 8601 UTC. For example, <strong id="obs_04_0012__b26461148154015">expiration: 2017-12-31T12:00:00.000Z</strong> in the example means that the request becomes invalid after 12:00:00 on December 31, 2017. This field must be specified in a policy. It can only be in the <strong id="obs_04_0012__b731218169568">yyyy-MM-dd'T'HH:mm:ss'Z'</strong> or <strong id="obs_04_0012__b152251626105618">yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</strong> format.</p>
</div>
<div class="section" id="obs_04_0012__section675581585817"><a name="obs_04_0012__section675581585817"></a><a name="section675581585817"></a><h4 class="sectiontitle">Conditions</h4><p id="obs_04_0012__p14022336112311">A mechanism used to verify the validity of a request. Conditions are used to define the content that must be contained in a request. In the example, the requested bucket name is <strong id="obs_04_0012__b15263218957">book</strong>, the object name is prefixed with <strong id="obs_04_0012__b148109331357">user/</strong>, and the ACL of the object is public read. All items in the form, excluding <strong id="obs_04_0012__b863413910713">AccessKeyId</strong>, <strong id="obs_04_0012__b143399161378">signature</strong>, <strong id="obs_04_0012__b875317189710">file</strong>, <strong id="obs_04_0012__b58737221572">policy</strong>, <strong id="obs_04_0012__b9789214581">token</strong>, <strong id="obs_04_0012__b711014294713">field names</strong>, and the prefix <strong id="obs_04_0012__b1137839878">x-ignore-</strong>, must be included in the policy. The following table lists the items that should be contained in <strong id="obs_04_0012__b15590161912916">Conditions</strong>.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0012__table55005442113719" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Conditions contained in a policy</caption><thead align="left"><tr id="obs_04_0012__row14888369113719"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.3.2.3.1.1"><p id="obs_04_0012__p62023614113732">Element</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.3.2.3.1.2"><p id="obs_04_0012__p44580065113732">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0012__row52541302113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p34519469113732">x-obs-acl</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p2777982113732">ACL in the request.</p>
<p id="obs_04_0012__p151110207418">Supports exact match and conditional match such as <strong id="obs_04_0012__b14991194041010">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row54079811113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p49660762113732">content-length-range</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p35791123113732">Maximum and minimum length of an object to be uploaded. The value can be a range.</p>
</td>
</tr>
<tr id="obs_04_0012__row58784528113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p22415372113732">Cache-Control, Content-Type, Content-Disposition, Content-Encoding, Expires</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p34643877113732">Headers specially for REST requests</p>
<p id="obs_04_0012__p2083656688">Supports exact match and conditional match such as <strong id="obs_04_0012__b8457106131613">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row30885555113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p34019372113732">key</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p59246164113732">Name of an object to be uploaded.</p>
<p id="obs_04_0012__p1018771694">Supports exact match and conditional match such as <strong id="obs_04_0012__b1655783713167">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row37187508114342"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p24227248114342">bucket</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p12133926114342">Name of the requested bucket.</p>
<p id="obs_04_0012__p10764913114435">Supports exact match.</p>
</td>
</tr>
<tr id="obs_04_0012__row42273577113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p51960229113732">success_action_redirect</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p20267479113732">Redirection address after the upload is successful. For details, see <a href="obs_04_0081.html">Uploading an Object - POST</a>.</p>
<p id="obs_04_0012__p177513101917">Supports exact match and conditional match such as <strong id="obs_04_0012__b594644641710">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row7283158113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p3098079113732">success_action_status</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p1378743014374">If <strong id="obs_04_0012__b882183817395">success_action_redirect</strong> is not specified, the status code is returned to the client when the upload is successful. For details, see <a href="obs_04_0081.html">Uploading an Object - POST</a>.</p>
<p id="obs_04_0012__p65023749113732">Supports exact match.</p>
</td>
</tr>
<tr id="obs_04_0012__row30535112113719"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p57965887113732">x-obs-meta-*</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p63311849113732">User-defined metadata.</p>
<p id="obs_04_0012__p139062245812">Keywords in an element cannot contain non-ASCII or unrecognizable characters. If non-ASCII or unrecognizable characters are necessary, they should be encoded and decoded on the client side. Either URL encoding or Base64 encoding is acceptable, but the server does not perform decoding.</p>
<p id="obs_04_0012__p84615165917">Supports exact match and conditional match such as <strong id="obs_04_0012__b17415793198">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row46456287114226"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p5722569114226">x-obs-*</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p8998474114226">Other header fields with prefix <strong id="obs_04_0012__b6828733141912">x-obs-</strong>.</p>
<p id="obs_04_0012__p19512131913910">Supports exact match and conditional match such as <strong id="obs_04_0012__b22315477197">starts-with</strong>.</p>
</td>
</tr>
<tr id="obs_04_0012__row6679201043615"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.1 "><p id="obs_04_0012__p12679151013615"><span style="color:#3D3F43;">x-obs-security-token</span></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.3.2.3.1.2 "><p id="obs_04_0012__p96809100363">Field name in the request header.</p>
<p id="obs_04_0012__p18776112923818">Mandatory field for the temporary AK/SK and security token authentication.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_04_0012__p30406164114831">The table below describes how policy conditions can be matched.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0012__table49086577114935" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Policy condition matching methods</caption><thead align="left"><tr id="obs_04_0012__row30029674114935"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.5.2.3.1.1"><p id="obs_04_0012__p38977014114935">Matching Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.5.2.3.1.2"><p id="obs_04_0012__p23527466114935">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0012__row54464857114935"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.1 "><p style="color:#444444;" id="obs_04_0012__p58682586115013">Exact Matches</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.2 "><p id="obs_04_0012__p46070477115013">Exact match by default. The value in the POST table must be the same as that in the policy. For example, if object ACL is set to <strong id="obs_04_0012__b14741114512343">public-read</strong> when the object is uploaded, the value of the <strong id="obs_04_0012__b13750162583416">x-obs-acl</strong> element in the table is <strong id="obs_04_0012__b81913883419">public-read</strong>. Therefore, the conditions in the policy can be set to</p>
<p style="color:#000000;" id="obs_04_0012__p5561898115013">{"x-obs-acl": "public-read"} or ["eq", "$x-obs-acl", "public-read"], which are equivalent.</p>
</td>
</tr>
<tr id="obs_04_0012__row45546541114935"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.1 "><p style="color:#000000;" id="obs_04_0012__p24034313115013">Starts With</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.2 "><p style="color:#000000;" id="obs_04_0012__p32512300115013">If this condition is used, the value set in the POST table must start with a fixed character string. For example, if the name of uploaded objects must be prefixed with <strong id="obs_04_0012__b15212934124011">user/</strong>, the value of the <strong id="obs_04_0012__b18397192464118">key</strong> element in the table can be <strong id="obs_04_0012__b205701838174111">user/test1</strong>, <strong id="obs_04_0012__b173191647204118">user/test2</strong>, and so on. Therefore, conditions in the policy can be set to:</p>
<p style="color:#000000;" id="obs_04_0012__p58348378115013"><strong id="obs_04_0012__b1744110572209">["starts-with", "$key", "user/"]</strong></p>
</td>
</tr>
<tr id="obs_04_0012__row460473114935"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.1 "><p style="color:#444444;" id="obs_04_0012__p36245453115013">Matching Any Content</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.2 "><p style="color:#000000;" id="obs_04_0012__p39946343115013">The corresponding element in the POST table can be any value. For example, if the redirection address upon request success can be any address, the value of the <strong id="obs_04_0012__b13651153120440">success_action_redirect</strong> element in the table can be any value. Therefore, conditions in the policy can be set to:</p>
<p style="color:#000000;" id="obs_04_0012__p33616520115013"><strong id="obs_04_0012__b14906857210">["starts-with", "$success_action_redirect", ""]</strong></p>
</td>
</tr>
<tr id="obs_04_0012__row14933139114935"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.1 "><p style="color:#444444;" id="obs_04_0012__p27517045115013">Specifying Ranges</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.5.2.3.1.2 "><p style="color:#000000;" id="obs_04_0012__p43362737115013">The content length of the <strong id="obs_04_0012__b198821610463">file</strong> element in the POST table can be a specified range and is used only to limit the object size. For example, if the size of the uploaded object is between 1 MB to 10 MB, the content length of the <strong id="obs_04_0012__b8489113354712">file</strong> element in the table can be from <strong id="obs_04_0012__b918614513478">1048576</strong> to <strong id="obs_04_0012__b8399145634714">10485760</strong>. Therefore, conditions in the policy can be set to (the value does not contain quotation marks)</p>
<p style="color:#000000;" id="obs_04_0012__p56793526115013"><strong id="obs_04_0012__b021832151712">["content-length-range", 1048576, 10485760]</strong></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="obs_04_0012__note114221355114513"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_04_0012__p1898164683720">A policy is in the JSON format. Conditions can be put in curly brackets {} and square brackets []. The key and value elements of the table are written in the curly brackets {}, which are separated by colons (:). The square brackets [] contain the condition type, key, and value. These three items are separated by commas (,). The dollar sign ($) in front of the key indicates that the key is a variable.</p>
</div></div>
<p id="obs_04_0012__p4782727211850">The table below lists the characters that must be escaped in a policy.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0012__table35624816115455" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Characters that must be escaped in a policy</caption><thead align="left"><tr id="obs_04_0012__row56560712115455"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.8.2.3.1.1"><p id="obs_04_0012__p56433267115455">Character After Escape</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.8.8.2.3.1.2"><p id="obs_04_0012__p10493805115455">Real Character</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0012__row28107774115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p41520622115558">\\</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p15303787115558">Backslash (\)</p>
</td>
</tr>
<tr id="obs_04_0012__row50150707115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p44925486115558">\$</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p40072516115558">Dollar symbol ($)</p>
</td>
</tr>
<tr id="obs_04_0012__row58342603115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p11691910115558">\b</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p54299552115558">Backspace</p>
</td>
</tr>
<tr id="obs_04_0012__row22327466115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p62039181115558">\f</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p8429155115558">Page up and down</p>
</td>
</tr>
<tr id="obs_04_0012__row28103774115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p38038269115558">\n</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p8632859115558">Newline characters</p>
</td>
</tr>
<tr id="obs_04_0012__row19271291115548"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p30278910115558">\r</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p25494076115558">Enter</p>
</td>
</tr>
<tr id="obs_04_0012__row36368988115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p48639067115558">\t</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p4227991812149">Horizontal table</p>
</td>
</tr>
<tr id="obs_04_0012__row2820788115544"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p61717449115558">\v</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p18109849115558">Vertical table</p>
</td>
</tr>
<tr id="obs_04_0012__row9482048115455"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.1 "><p id="obs_04_0012__p7506470115558">\u<strong id="obs_04_0012__b3844454812350"><em style="color:#000000;" id="obs_04_0012__i2839312312350">xxxx</em></strong></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.8.8.2.3.1.2 "><p id="obs_04_0012__p19910590115558">All Unicode characters</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_04_0012__section16465115417593"><h4 class="sectiontitle">Request and Policy Examples</h4><p id="obs_04_0012__p17279423112315">The following tables provide examples of requests and policies.</p>
<p id="obs_04_0012__p1894111291795"><strong id="obs_04_0012__b432813241051">Example 1</strong>: Upload the <strong id="obs_04_0012__b139567184219">testfile.txt</strong> object to bucket <strong id="obs_04_0012__b10956518823">examplebucket</strong> and set the object ACL to <strong id="obs_04_0012__b1395615181522">public-read</strong>.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0012__table061283019265" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_04_0012__row4612630112614"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.9.4.1.3.1.1"><p id="obs_04_0012__p961217308266">Request</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.9.4.1.3.1.2"><p id="obs_04_0012__p19612130192612">Policy</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0012__row5613173015268"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.9.4.1.3.1.1 "><p id="obs_04_0012__p1699923713576">POST / HTTP/1.1</p>
<p id="obs_04_0012__p66397298558">Host: examplebucket.obs.<em id="obs_04_0012__i136391229135514">region</em>.example.com</p>
<p id="obs_04_0012__p89996374577">Content-Type: multipart/form-data; boundary=7e32233530b26</p>
<p id="obs_04_0012__p149991837205714">Content-Length: 1250</p>
<p id="obs_04_0012__p9974124075718"></p>
<p id="obs_04_0012__p983882815575">--7e32233530b26</p>
<p id="obs_04_0012__p9838112875716">Content-Disposition: form-data; name="key"</p>
<p id="obs_04_0012__p6838142805720"></p>
<p id="obs_04_0012__p148382028195710">testfile.txt</p>
<p id="obs_04_0012__p68382289579">--7e32233530b26</p>
<p id="obs_04_0012__p1183882815576">Content-Disposition: form-data; name="x-obs-acl"</p>
<p id="obs_04_0012__p68382288571"></p>
<p id="obs_04_0012__p158381281572">public-read</p>
<p id="obs_04_0012__p28383281570">--7e32233530b26</p>
<p id="obs_04_0012__p683842819578">Content-Disposition: form-data; name="content-type"</p>
<p id="obs_04_0012__p1283882818576"></p>
<p id="obs_04_0012__p3838162816571">text/plain</p>
<p id="obs_04_0012__p4838152816571">--7e32233530b26</p>
<p id="obs_04_0012__p483892885716">Content-Disposition: form-data; name="AccessKeyId"</p>
<p id="obs_04_0012__p6838328135713"></p>
<p id="obs_04_0012__p383819287574">UDSIAMSTUBTEST000002</p>
<p id="obs_04_0012__p883852845719">--7e32233530b26</p>
<p id="obs_04_0012__p48383288574">Content-Disposition: form-data; name="policy"</p>
<p id="obs_04_0012__p14838228125718"></p>
<p id="obs_04_0012__p148385281579">ewogICJleHBpcmF0aW9uIjogIjIwMTktMDctMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImJ1Y2tldCI6ICJleGFtcGxlYnVja2V0IiB9LAogICAgWyJlcSIsICIka2V5IiwgInRlc3RmaWxlLnR4dCJdLAoJeyJ4LW9icy1hY2wiOiAicHVibGljLXJlYWQiIH0sCiAgICBbImVxIiwgIiRDb250ZW50LVR5cGUiLCAidGV4dC9wbGFpbiJdLAogICAgWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDYsIDEwXQogIF0KfQo=</p>
<p id="obs_04_0012__p7838152885712">--7e32233530b26</p>
<p id="obs_04_0012__p783817282576">Content-Disposition: form-data; name="signature"</p>
<p id="obs_04_0012__p1383842855715"></p>
<p id="obs_04_0012__p1583814283578">xxl7bZs/5FgtBUggOdQ88DPZUo0=</p>
<p id="obs_04_0012__p1983862819575">--7e32233530b26</p>
<p id="obs_04_0012__p3838628115716">Content-Disposition: form-data; name="file"; filename="E:\TEST_FILE\TEST.txt"</p>
<p id="obs_04_0012__p19838328165719">Content-Type: text/plain</p>
<p id="obs_04_0012__p7838132835719"></p>
<p id="obs_04_0012__p18838728105719">123456</p>
<p id="obs_04_0012__p1838928145711">--7e32233530b26</p>
<p id="obs_04_0012__p18381628125711">Content-Disposition: form-data; name="submit"</p>
<p id="obs_04_0012__p68381128105710"></p>
<p id="obs_04_0012__p483982895718">Upload</p>
<p id="obs_04_0012__p183972855714">--7e32233530b26--</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.9.4.1.3.1.2 "><p id="obs_04_0012__p93031489587">{</p>
<p id="obs_04_0012__p163031787585">"expiration": "2019-07-01T12:00:00.000Z",</p>
<p id="obs_04_0012__p103031817581">"conditions": [</p>
<p id="obs_04_0012__p113031389588">{"bucket": "examplebucket" },</p>
<p id="obs_04_0012__p14303198195811">["eq", "$key", "testfile.txt"],</p>
<p id="obs_04_0012__p1730314817583">{"x-obs-acl": "public-read" },</p>
<p id="obs_04_0012__p1730312815582">["eq", "$Content-Type", "text/plain"]</p>
<p id="obs_04_0012__p0303208145811">]</p>
<p id="obs_04_0012__p153037816583">}</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_04_0012__p1199618161015"><strong id="obs_04_0012__b112351932565">Example 2</strong>: Upload the <strong id="obs_04_0012__b5493131124110">file/obj1</strong> object to bucket <strong id="obs_04_0012__b049916116410">examplebucket</strong> and configure the four custom metadata items of the object.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0012__table814893717114" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_04_0012__row1114993771115"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.9.6.1.3.1.1"><p id="obs_04_0012__p12149133712111">Request</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.9.6.1.3.1.2"><p id="obs_04_0012__p18149123711118">Policy</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_04_0012__row111491137101119"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.9.6.1.3.1.1 "><p id="obs_04_0012__p2021852865317">POST / HTTP/1.1</p>
<p id="obs_04_0012__p55705177569">Host: examplebucket.obs.<em id="obs_04_0012__i15708179561">region</em>.example.com</p>
<p id="obs_04_0012__p121919281534">Content-Type: multipart/form-data; boundary=7e329d630b26</p>
<p id="obs_04_0012__p521982805317">Content-Length: 1597</p>
<p id="obs_04_0012__p379215416302"></p>
<p id="obs_04_0012__p120194512296">--7e3542930b26</p>
<p id="obs_04_0012__p1920174582912">Content-Disposition: form-data; name="key"</p>
<p id="obs_04_0012__p5201164522912"></p>
<p id="obs_04_0012__p620144542910">file/obj1</p>
<p id="obs_04_0012__p820118453291">--7e3542930b26</p>
<p id="obs_04_0012__p9201745152913">Content-Disposition: form-data; name="AccessKeyId"</p>
<p id="obs_04_0012__p1120117456296"></p>
<p id="obs_04_0012__p1520154582916">UDSIAMSTUBTEST000002</p>
<p id="obs_04_0012__p202016458297">--7e3542930b26</p>
<p id="obs_04_0012__p1620184522913">Content-Disposition: form-data; name="policy"</p>
<p id="obs_04_0012__p3202154519290"></p>
<p id="obs_04_0012__p22020459295">ewogICJleHBpcmF0aW9uIjogIjIwMTktMDctMDFUMTI6MDA6MDAuMDAwWiIsCiAgImNvbmRpdGlvbnMiOiBbCiAgICB7ImJ1Y2tldCI6ICJleGFtcGxlYnVja2V0IiB9LAogICAgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgImZpbGUvIl0sCiAgICB7Ingtb2JzLW1ldGEtdGVzdDEiOiJ2YWx1ZTEifSwKICAgIFsiZXEiLCAiJHgtb2JzLW1ldGEtdGVzdDIiLCAidmFsdWUyIl0sCiAgICBbInN0YXJ0cy13aXRoIiwgIiR4LW9icy1tZXRhLXRlc3QzIiwgImRvYyJdLAogICAgWyJzdGFydHMtd2l0aCIsICIkeC1vYnMtbWV0YS10ZXN0NCIsICIiXQogIF0KfQo=</p>
<p id="obs_04_0012__p11202745142919">--7e3542930b26</p>
<p id="obs_04_0012__p8202174572916">Content-Disposition: form-data; name="signature"</p>
<p id="obs_04_0012__p14202104512920"></p>
<p id="obs_04_0012__p102021145192913">HTId8hcaisn6FfdWKqSJP9RN4Oo=</p>
<p id="obs_04_0012__p3202114512295">--7e3542930b26</p>
<p id="obs_04_0012__p1520294522915">Content-Disposition: form-data; name="x-obs-meta-test1"</p>
<p id="obs_04_0012__p420213458294"></p>
<p id="obs_04_0012__p13202045172911">value1</p>
<p id="obs_04_0012__p3202154582912">--7e3542930b26</p>
<p id="obs_04_0012__p920213458297">Content-Disposition: form-data; name="x-obs-meta-test2"</p>
<p id="obs_04_0012__p18202124582919"></p>
<p id="obs_04_0012__p102026451299">value2</p>
<p id="obs_04_0012__p12202184572915">--7e3542930b26</p>
<p id="obs_04_0012__p10202114519292">Content-Disposition: form-data; name="x-obs-meta-test3"</p>
<p id="obs_04_0012__p120234532918"></p>
<p id="obs_04_0012__p12202445182913">doc123</p>
<p id="obs_04_0012__p320284572919">--7e3542930b26</p>
<p id="obs_04_0012__p14202174518296">Content-Disposition: form-data; name="x-obs-meta-test4"</p>
<p id="obs_04_0012__p17202164512917"></p>
<p id="obs_04_0012__p1620264572910">my</p>
<p id="obs_04_0012__p1720216453297">--7e3542930b26</p>
<p id="obs_04_0012__p3202345192913">Content-Disposition: form-data; name="file"; filename="E:\TEST_FILE\TEST.txt"</p>
<p id="obs_04_0012__p17202164513290">Content-Type: text/plain</p>
<p id="obs_04_0012__p20202345122915"></p>
<p id="obs_04_0012__p9202164516299">123456</p>
<p id="obs_04_0012__p42024455292">--7e3542930b26</p>
<p id="obs_04_0012__p02021045142915">Content-Disposition: form-data; name="submit"</p>
<p id="obs_04_0012__p12202845152913"></p>
<p id="obs_04_0012__p720254513295">Upload</p>
<p id="obs_04_0012__p1202345112917">--7e3542930b26--</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.9.6.1.3.1.2 "><p id="obs_04_0012__p1123220352302">{</p>
<p id="obs_04_0012__p1323293512300">"expiration": "2019-07-01T12:00:00.000Z",</p>
<p id="obs_04_0012__p52321935103010">"conditions": [</p>
<p id="obs_04_0012__p2232123523020">{"bucket": "examplebucket" },</p>
<p id="obs_04_0012__p1523283513018">["starts-with", "$key", "file/"],</p>
<p id="obs_04_0012__p1623218359303">{"x-obs-meta-test1":"value1"},</p>
<p id="obs_04_0012__p15232535113014">["eq", "$x-obs-meta-test2", "value2"],</p>
<p id="obs_04_0012__p17232193563017">["starts-with", "$x-obs-meta-test3", "doc"],</p>
<p id="obs_04_0012__p11232235163011">["starts-with", "$x-obs-meta-test4", ""]</p>
<p id="obs_04_0012__p023253553018">]</p>
<p id="obs_04_0012__p82321235113014">}</p>
<p id="obs_04_0012__p4232103515303"></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0008.html">Authentication</a></div>
</div>
</div>