2016-06-08 67 views

回答

1

不。如果您簽署指定「PUT」動詞的URL,則必須發出PUT請求。

有一種方法可以使用簽名和POST動詞上載對象,但它不帶有簽名的URL。它與已簽名的策略請求類似,但更爲複雜:https://cloud.google.com/storage/docs/xml-api/post-object#usage_and_examples

使用策略文檔,您可以指定若干關於POST上傳的規則,base64策略,然後爲該策略創建一個簽名。 POST請求必須包含策略及其簽名。它設計用於網頁表單,如下所示:

<form action="http://travel-maps.storage.googleapis.com" method="post" enctype="multipart/form-data"> 
<input type="text" name="key" value=""> 
<input type="hidden" name="bucket" value="travel-maps"> 
<input type="hidden" name="Content-Type" value="image/jpeg"> 
<input type="hidden" name="GoogleAccessId" value="[email protected]"> 
<input type="hidden" name="acl" value="bucket-owner-read"> 
<input type="hidden" name="success_action_redirect" value="http://www.example.com/success_notification.html"> 
<input type="hidden" name="policy" value="eyJleHBpcmF0aW9uIjogIjIwMTAtMDYtMTZUMTE6MTE6MTFaIiwNCiAiY29uZGl0aW9ucyI6IFsNCiAgWyJzdGFydHMtd2l0aCIsICJrZXkiLCAiIiBdLA0KICB7ImFjbCI6ICJidWNrZXQtb3duZXItcmVhZCIgfSwNCiAgeyJidWNrZXQiOiAidHJhdmVsLW1hcHMifSwNCiAgeyJzdWNjZXNzX2FjdGlvbl9yZWRpcmVjdCI6ICJodHRwOi8vd3d3LmV4YW1wbGUuY29tL3N1Y2Nlc3Nfbm90aWZpY2F0aW9uLmh0bWwiIH0sDQogIFsiZXEiLCAiQ29udGVudC1UeXBlIiwgImltYWdlL2pwZWciIF0sDQogIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAwLCAxMDAwMDAwXQ0KICBdDQp9"> 
<input type="hidden" name="signature" value="BSAMPLEaASAMPLE6SAMPLE+SAMPPLEqSAMPLEPSAMPLE+SAMPLEgSAMPLEzCPlgWREeF7oPGowkeKk7J4WApzkzxERdOQmAdrvshKSzUHg8Jqp1lw9tbiJfE2ExdOOIoJVmGLoDeAGnfzCd4fTsWcLbal9sFpqXsQI8IQi1493mw="> 

<input name="file" type="file"> 
<input type="submit" value="Upload"> 
</form> 
相關問題