初始化Multipart Upload
Last updated
2023-07-14 10:51:23
{"value":"## **\u63cf\u8ff0**\n\n\u4f7f\u7528 Multipart Upload \u65b9\u5f0f\u4e0a\u4f20\u6570\u636e\u524d\uff0c\u5fc5\u987b\u5148\u8c03\u7528 API \u6765\u83b7\u53d6\u4e00\u4e2a\u5168\u5c40\u552f\u4e00\u7684 UploadId \uff0c\u540e\u7eed\u7684\u5757\u6570\u636e\u901a\u8fc7 uploadPart API \u4e0a\u4f20\uff0c\u6574\u4e2a\u6587\u4ef6\u5b8c\u6210 completeMultipartUpload API \uff0c\u5df2\u7ecf\u4e0a\u4f20\u5757\u7684\u5220\u9664 abortMultipartUpload API \u90fd\u4f9d\u8d56\u8be5 UploadId \u3002\n\n\n\n\n\n## **\u8bf7\u6c42**\n\n\n\n**\u8bf7\u6c42\u8bed\u6cd5**\n\n```\nPOST \/buckets\/<BucketName>\/objects\/<EncodedObjectName>\/uploads HTTP\/1.1\nHost: <UpHost>\nAuthorization: UpToken <UploadToken>\n```\n\n\u4f7f\u7528\u8bf4\u660e\uff1a\n\n- \u521d\u59cb\u5316 Multipart Upload \u8bf7\u6c42\uff0c\u5e76\u4e0d\u4f1a\u5f71\u54cd\u5df2\u5b58\u5728\u7684\u540c\u540d Object \u3002\n- \u540c\u4e00\u4e2a Object \u53ef\u4ee5\u540c\u65f6\u62e5\u6709\u4e0d\u540c\u7684 UploadId \u3002\n\n\n\n\n\n**\u8bf7\u6c42\u53c2\u6570**\n\n| \u53c2\u6570\u540d\u79f0 | \u5fc5\u586b | \u8bf4\u660e |\n| ----------------- | ---- | ------------------------------------------------------------ |\n| BucketName | \u662f | \u7a7a\u95f4\u540d\u79f0 |\n| EncodedObjectName | \u5426 | \u8d44\u6e90\u540d\uff0cEncodedObjectName \u9700\u8981\u7ecf\u8fc7 Base64 \u7f16\u7801\uff0c\u5982\u679c\u8868\u793a\u4e0d\u8bbe\u7f6e\u53ef\u4ee5\u4f7f\u7528\u7279\u6b8a\u5b57\u7b26 `~` \u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u7167\uff1aURL \u5b89\u5168\u7684 Base64 \u7f16\u7801 |\n\n\n\n\n\n**\u8bf7\u6c42\u5934**\n\n| \u5934\u90e8\u540d\u79f0 | \u5fc5\u586b | \u8bf4\u660e |\n| ------------- | ---- | ------------------------------------------------------------ |\n| Host | \u662f | \u4e0a\u4f20\u57df\u540d\u3002\u8bbf\u95ee\u57df\u540d\u5217\u8868 |\n| Authorization | \u662f | \u8be5\u53c2\u6570\u5e94\u4e25\u683c\u6309\u7167\u4e0a\u4f20\u51ed\u8bc1\u683c\u5f0f\u8fdb\u884c\u586b\u5145\uff0c\u5426\u5219\u4f1a\u8fd4\u56de 401 \u9519\u8bef\u7801\u3002\u4e00\u4e2a\u5408\u6cd5\u7684 Authorization \u503c\u5e94\u7c7b\u4f3c\u4e8e Authorization: UpToken QNJi_bYJlmO5LeY08FfoNj9w_r... |\n\n\n\n\n\n**\u8bf7\u6c42\u5185\u5bb9**\n\n\u8be5\u8bf7\u6c42\u64cd\u4f5c\u7684\u8bf7\u6c42\u4f53\u4e3a\u7a7a\u3002\n\n\n\n\n\n## **\u54cd\u5e94**\n\n\n\n**\u54cd\u5e94\u5934**\n\n\u8be5\u8bf7\u6c42\u64cd\u4f5c\u7684\u5b9e\u73b0\u4f7f\u7528\u4e86\u6240\u6709\u64cd\u4f5c\u7684\u516c\u5171\u54cd\u5e94\u5934\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u67e5\u9605\u516c\u5171\u54cd\u5e94\u5934\u3002\n\n\n\n\n\n**\u54cd\u5e94\u5185\u5bb9**\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ------------------------------------------------------------ |\n| uploadId | string | \u521d\u59cb\u5316\u6587\u4ef6\u751f\u6210\u7684 id |\n| expireAt | int64 | UploadId \u7684\u8fc7\u671f\u65f6\u95f4 Unix \u65f6\u95f4\u6233\uff0c\u8fc7\u671f\u4e4b\u540e UploadId \u4e0d\u53ef\u7528\uff0c\u56fa\u5b9a 7 \u5929\u6709\u6548\u671f |\n\n\n\n\n\n**\u54cd\u5e94\u72b6\u6001\u7801**\n\n\u8be5\u64cd\u4f5c\u7684\u5b9e\u73b0\u4e0d\u4f1a\u8fd4\u56de\u7279\u6b8a\u9519\u8bef\u3002\u6709\u5173\u9519\u8bef\u548c\u9519\u8bef\u4ee3\u7801\u5217\u8868\u7684\u4e00\u822c\u4fe1\u606f\uff0c\u8bf7\u67e5\u9605\u9519\u8bef\u54cd\u5e94\u3002\n\n\n\n\n\n## **\u793a\u4f8b**\n\n\n\n**\u8bf7\u6c42\u793a\u4f8b**\n\n```\nPOST \/buckets\/myBucket\/objects\/bXlPYmplY3Q=\/uploads HTTP\/1.1\nHost: up.qiniup.com\nUser-Agent: Go-http-client\/1.1\nAuthorization: UpToken j853F3bLkWl59I5BOkWm6q1Z1mZClpr9Z9CLfDE0:nP7NSSyGo4x3W_nJ8T9X1gJrgpk=\n```\n\n\n\n\n\n**\u54cd\u5e94\u793a\u4f8b**\n\n```\nHTTP\/1.1 200 OK\nContent-Length: 2\nConnection: keep-alive\nContent-Type: application\/json\nDate: Wed, 18 Dec 2019 17:02:11 GMT\nServer: nginx\nX-Reqid: SFkAAAC8BDebTtsU\n\n{\n \"uploadId\": \"5df9ea14834c512b2270234e\",\n \"expireAt\": 1576659776\n}\n```\n"}