Upload
POST https://dreamapi-oss.oss-cn-hongkong.aliyuncs.com
After the web receives all necessary information from the server, it can construct an HTML form request. This request will directly communicate with the OSS service to enable file upload.
- The form request contains file content and parameters returned by the server.
- Through this request, the web end can directly communicate with Alibaba Cloud's OSS to complete file upload.
Request Headers
Request Body
- success_action_statusstringRequiredSuccess status verification value. Fixed filling.
- policystringRequiredFile upload strategy.
- OSSAccessKeyIdstringRequiredAccess Id.
- signaturestringRequiredThis request for signature.
- keystringRequiredThe file path in OSS when upload success.
- callbackstringRequiredCallback url.
- filebinaryRequiredFile that need to be upload. This parameter must be the last parameter of the form.
Response
- codeinteger0 success, or error code.
- messagestring"success", or error msg.
- dataobjectverifyStatusbooleanreqIdstringThe request Id
Example
Request:
zsh
curl --location --request POST 'https://dreamapi-oss.oss-cn-hongkong.aliyuncs.com' \
--form 'policy="eyJ0leHBpcmF0aW9uIjoiMjAyNC0xMS0xOVQwODo0NDo0OC42MzZaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsNTM2ODcwOTEyMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ0bXBcL2RyZWFtXC8yMDI0LTExLTE5XC81MzY5MjA3ODIwOTg5MDAyXC8iXV19"' \
--form 'OSSAccessKeyId="LTAI5tF1QzxoHGvEcziVACyc"' \
--form 'success_action_status="200"' \
--form 'signature="G2TzrhlybemHbfFakysY4j2EI2I="' \
--form 'key="tmp/dream/2024-11-19/5369207820989002/1.png"' \
--form 'callback="eyJ0jYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9uZXdwb3J0YWkuY29tL3ByZS1haWdjLXByaW50LTJiL2ZpbGUvdjEvY2FsbGJhY2siLCJjYWxsYmFja0JvZHkiOiJ7XCJmaWxlbmFtZVwiOiR7b2JqZWN0fSxcInNpemVcIjoke3NpemV9LFwibWltZVR5cFwiOiR7bWltZVR5cGV9LFwiaGVpZ2h0XCI6JHtpbWFnZUluZm8uaGVpZ2h0fSxcIndpZHRoXCI6JHtpbWFnZUluZm8ud2lkdGh9LFwiYnVja2V0XCI6JHtidWNrZXR9LFwiZXRhZ1wiOiR7ZXRhZ30sXCJmb3JtYXRcIjoke2ltYWdlSW5mby5mb3JtYXR9LFwiY29udGVudE1kNVwiOiR7Y29udGVudE1kNX0sXCJjbGllbnRJcFwiOiR7Y2xpZW50SXB9LFwicmVxSWRcIjoke3JlcUlkfSxcIm9wZXJhdGlvblwiOiR7b3BlcmF0aW9ufSxcImJpeklkXCI6XCI3MzJjOWNhYS0wYTJlLTRhYTEtODdkOS01MjQzMGE4ZjAzMTRcIn0ifQ=="' \
--form 'file=@"/2024.09/20e319b2-2c31-4977-b486-8cb37a0b6663.png"'
Response:
json
{
"code": 0,
"message": "success",
"data": {
"verifyStatus": false,
"reqId": "732c9caa-0a2e-4aa1-87d9-52430a8f0314"
}
}