表单上传
Last updated
2023-07-11 16:59:50
{"value":"\u8868\u5355\u4e0a\u4f20\u9002\u7528\u4e8e\u6587\u4ef6\u5185\u5bb9\u53ef\u4ee5\u5728\u4e00\u6b21 HTTP \u8bf7\u6c42\u5373\u53ef\u4f20\u9012\u5b8c\u6210\u7684\u573a\u666f\u3002\u8be5\u529f\u80fd\u975e\u5e38\u9002\u5408\u5728\u6d4f\u89c8\u5668\u4e2d\u4f7f\u7528 HTML \u8868\u5355\u4e0a\u4f20\u8d44\u6e90\uff0c\u6216\u8005\u5728\u4e0d\u9700\u8981\u5904\u7406\u590d\u6742\u60c5\u51b5\u7684\u5ba2\u6237\u7aef\u5f00\u53d1\u4e2d\u4f7f\u7528\u3002\u5982\u679c\u6587\u4ef6\u8f83\u5927\uff08\u5927\u4e8e 1GB\uff09\uff0c\u6216\u8005\u7f51\u7edc\u73af\u5883\u8f83\u5dee\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4 HTTP \u8fde\u63a5\u8d85\u65f6\u800c\u4e0a\u4f20\u5931\u8d25\u3002\u82e5\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\uff0c\u60a8\u9700\u8981\u8003\u8651\u6362\u7528\u66f4\u5b89\u5168\u7684\u5206\u7247\u4e0a\u4f20\u529f\u80fd\u3002\n\n\u5f00\u53d1\u8005\u53ea\u8981\u7ec4\u88c5\u4e00\u4e2a\u7b26\u5408 HTML \u6587\u4ef6\u4e0a\u4f20\u8868\u5355\u89c4\u8303\uff08\u53c2[RFC1867\uff09\u7684 HTTP \u8bf7\u6c42\uff0c\u5e76\u4ee5 POST \u65b9\u5f0f\u5411\u57df\u540d upload.qiniup.com \u53d1\u8d77\u8fd9\u4e2a\u8bf7\u6c42\uff0c\u5373\u53ef\u5c06\u6307\u5b9a\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u7aef\u3002\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\u8bf7\u53c2\u8003\u8868\u5355\u4e0a\u4f20 API\u3002\n\n\n\n\n\n# **\u4f7f\u7528\u65b9\u6cd5**\n\n\u6211\u4eec\u53ef\u4ee5\u7528\u5982\u4e0b\u7684 HTML \u8868\u5355\u6765\u63cf\u8ff0\u8868\u5355\u4e0a\u4f20\u7684\u57fa\u672c\u7528\u6cd5\uff1a\n\n![](https:\/\/tp2lravq.hk03.1112oss.com\/202307111659456s4hlfpp7o9op9b33sipqkrvulvjqplr.png)\n\n\u5173\u952e\u53c2\u6570\u8bf4\u660e\uff1a\n\n| \u540d\u79f0 | \u7c7b\u578b | \u5fc5\u586b | \u8bf4\u660e | |\n| ------------ | ------ | ---- | ------------------------------------------------------------ | ---- |\n| action | string | \u662f | \u4e0a\u4f20\u5730\u5740 | |\n| resource_key | string | \u5426 | \u8d44\u6e90\u540d\uff0c\u5fc5\u987b\u662f UTF-8 \u7f16\u7801\u3002**\u6ce8\u610f\uff1a** \u5982\u679c[\u4e0a\u4f20\u51ed\u8bc1]\u4e2d scope \u6307\u5b9a\u4e3a <bucket>:<key>\uff0c \u5219\u8be5\u5b57\u6bb5\u4e5f\u5fc5\u987b\u6307\u5b9a\u3002 | |\n| custom_name | string | \u5426 | \u81ea\u5b9a\u4e49\u53d8\u91cf\u7684\u540d\u5b57\uff0c\u4e0d\u9650\u4e2a\u6570\u3002 | |\n| custom_value | string | \u5426 | \u81ea\u5b9a\u4e49\u53d8\u91cf\u7684\u503c\u3002 | |\n| upload_token | string | \u662f | \u5fc5\u987b\u662f\u4e00\u4e2a\u7b26\u5408\u76f8\u5e94\u89c4\u683c\u7684\u4e0a\u4f20\u51ed\u8bc1\uff0c\u5426\u5219\u4f1a\u8fd4\u56de 401 \u8868\u793a\u6743\u9650\u8ba4\u8bc1\u5931\u8d25\u3002 | |\n| crc32 | string | \u5426 | \u4e0a\u4f20\u5185\u5bb9\u7684 crc32 \u6821\u9a8c\u7801\u3002\u5982\u586b\u5165\uff0c\u5219\u79c1\u6709\u4e91\u5b58\u50a8\u670d\u52a1\u5668\u4f1a\u4f7f\u7528\u6b64\u503c\u8fdb\u884c\u5185\u5bb9\u68c0\u9a8c\u3002 | |\n| accept | string | \u5426 | \u5f53 HTTP \u8bf7\u6c42\u6307\u5b9a accept \u5934\u90e8\u65f6\uff0c\u79c1\u6709\u4e91\u5b58\u50a8\u4f1a\u8fd4\u56de content-type \u5934\u90e8\u7684\u503c\u3002\u8be5\u503c\u7528\u4e8e\u517c\u5bb9\u4f4e\u7248\u672c IE \u6d4f\u89c8\u5668\u884c\u4e3a\u3002\u4f4e\u7248\u672c IE \u6d4f\u89c8\u5668\u5728\u8868\u5355\u4e0a\u4f20\u65f6\uff0c\u8fd4\u56de application\/json \u8868\u793a\u4e0b\u8f7d\uff0c\u8fd4\u56de text\/plain \u624d\u4f1a\u663e\u793a\u8fd4\u56de\u5185\u5bb9\u3002 | |\n| file | file | \u662f | \u6587\u4ef6\u672c\u8eab\u3002 | |\n\n\u63d0\u4ea4\u4ee5\u4e0a HTML \u8868\u5355\u800c\u751f\u6210\u7684 HTTP \u8bf7\u6c42\u5185\u5bb9\u5927\u81f4\u5982\u4e0b\uff1a\n\n```\nPOST \/ HTTP\/1.1\nHost: <UpHost>\nContent-Type: multipart\/form-data; boundary=<frontier>\nContent-Length: <multipartContentLength>\n\n--<frontier>\nContent-Disposition: form-data; name=\"key\"\n\n<resource_key>\n--<frontier>\nContent-Disposition: form-data; name=\"x:<custom_name>\"\n\n<custom_value>\n--<frontier>\nContent-Disposition: form-data; name=\"token\"\n\n<upload_token>\n--<frontier>\nContent-Disposition: form-data; name=\"crc32\"\n\n<crc32>\n--<frontier>\nContent-Disposition: form-data; name=\"accept\"\n\n<acceptContentType>\n--<frontier>\nContent-Disposition: form-data; name=\"file\"; filename=\"<fileName>\"\nContent-Type: application\/octet-stream\nContent-Transfer-Encoding: binary\n\n<fileBinaryData>\n--<frontier>--\n```\n\n\u5728\u975e\u7f51\u9875\u5f00\u53d1\u7684\u573a\u666f\u4e2d\uff0c\u5f00\u53d1\u8005\u5b8c\u5168\u53ef\u4ee5\u81ea\u884c\u7ec4\u88c5\u8fd9\u4e2a HTML \u8868\u5355\u8bf7\u6c42\u3002\u8003\u8651\u5230\u5404\u4e2a\u5e73\u53f0\u4e0a\u7684\u7f51\u7edc\u5e93\u90fd\u5df2\u7ecf\u5bf9 HTML \u6587\u4ef6\u4e0a\u4f20\u8868\u5355\u6709\u975e\u5e38\u5b8c\u6574\u7684\u652f\u6301\uff0c\u7ec4\u88c5\u8fd9\u4e2a\u8bf7\u6c42\u7684\u8fc7\u7a0b\u5c06\u4f1a\u975e\u5e38\u8f7b\u677e\u3002\n\n\n\n\n\n# **\u540e\u7eed\u52a8\u4f5c**\n\n\u6211\u4eec\u53ef\u4ee5\u5728\u751f\u6210\u4e0a\u4f20\u51ed\u8bc1\u65f6\u6307\u5b9a\u4e00\u7cfb\u5217\u7684\u53c2\u6570\uff0c\u4ee5\u63a7\u5236\u670d\u52a1\u5668\u5728\u6587\u4ef6\u4e0a\u4f20\u5b8c\u6210\u540e\u7684\u540e\u7eed\u52a8\u4f5c\u3002\u53e6\u5916\u5982\u679c\u9700\u8981\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u8868\u5355\u53c2\u6570\u4e2d\u589e\u52a0\u4e00\u7cfb\u5217\u9b54\u6cd5\u53d8\u91cf\u548c\u81ea\u5b9a\u4e49\u53d8\u91cf\u3002\u4e0a\u8ff0\u8868\u5355\u4f8b\u5b50\u4e2d\u7684`x:<custom_name>`\u5c31\u662f\u53d8\u91cf\u7684\u4f7f\u7528\u65b9\u6cd5\u793a\u4f8b\u3002\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u66f4\u6362\u4e3a\u4e00\u7cfb\u5217\u9b54\u6cd5\u53d8\u91cf\u6216\u81ea\u5b9a\u4e49\u53d8\u91cf\u3002\n\n\u53d8\u91cf\u5c06\u4f1a\u5728\u56de\u8c03\u548c\u81ea\u5b9a\u4e49\u8fd4\u56de\u5185\u5bb9\u4e2d\u8d77\u5230\u6781\u5927\u7684\u4f5c\u7528\u3002\u5177\u4f53\u7528\u6cd5\u8bf7\u53c2\u8003\u56de\u8c03\u901a\u77e5(callback)\u548c\u81ea\u5b9a\u4e49\u54cd\u5e94\u5185\u5bb9(ReturnBody)\u3002"}