Last update:2025-08-18 15:31:55
Normal Upload interface provides the capability to upload a resource file to a specified bucket on the object storage platform. If the size of a file is larger than 500MB, multipart upload must be used. Normal Upload also supports to upload through HTML form.
NOTE:
- The recommended size of a file for multipart upload varies by the environment. Please refer to the recommended values given in the relevant SDK.
- The upload domain name provided by the Object Storage is an ordinary domain name.
Upload requests are submitted in the HTTP multipart/form-data format. An example is as follows:
POST /file/upload HTTP/1.1
Host: <UploadDomain>
Accept: */*
Content-Type: multipart/form-data; boundary=<boundary>
Content-Length: <multipartContentLength>
--<boundary>
Content-Disposition: form-data; name="token"
<uploadToken>
--<boundary>
Content-Disposition: form-data; name="<x:VariableName>"
<x:VariableValue>
--<boundary>
Content-Disposition: form-data; name="key"
<key>
--<boundary>
Content-Disposition: form-data; name="mimeType"
<mimeType>
--<boundary>
Content-Disposition: form-data; name="deadline"
<deadline>
--<boundary>
Content-Disposition: form-data; name="file"; filename="original file name"
Content-Type: application/octet-stream
<fileBinaryData>
--<boundary>--
| Header Name | Required | Description |
|---|---|---|
| Host | Yes | Upload Domain Name, which can be obtained from the Console Overview interface. |
| Accept | Yes | Type of acceptance, which is fixed as */*. |
| Content-Type | Yes | Type of content, which is fixed as multipart/form-data. <boundary> is the Multipart separator. |
| Content-Length | Yes | Total length of content, unit: Bytes. |
| Parameter | Required | Description |
|---|---|---|
| <token> | Yes | Upload Credential |
| <x:VariableName> | No | Name of value of custom variable. |
| <x:VariableValue> | No | Value of custom variable. |
| <key> | No | Custom File Name |
| <mimeType> | No | MIME-Type of custom file. |
| <deadline> | No | File storage life. Files that exceed the number of storage days will be deleted automatically, unit: Days. For example: 1, 2, 3... NOTE: 0 indicates deletion as soon as possible. Configuration of 0 during file upload is not recommended |
| <file> | Yes | File information. When no filename is specified, the file's fileName attribute will be read as the filename. |
| <fileBinaryData> | Yes | Binary stream of the file. |
HTTP/1.1 200 OK
Server: WS-web-server
<ResponseContent>
If a request is successful,
hash=<filehash>
Core Field Description:
| Field name | Required | Description |
|---|---|---|
| <filehash> | Yes | The file’s hash value. |
NOTE: If returnBody is defined at the time of the upload, the content of
returnBodywill be added to the returned content, such as name=&size= hash= .
If the request fails, will be a JSON-format string containing the following fields:
{
"code": "<code string>",
"message": "<message string>"
}
Error Field Description:
| Field name | Required | Description |
|---|---|---|
| code | Yes | HTTP Response Status Code |
| message | Yes | Prompt message. |
curl -v -i -X POST -H "Expect:" -F file=@D:/8.png -F key=m.png -F token="6a69ab4062cb03059e4c13a0f5e662523effad49:ZGE1MWY1YzA4ZDgyMjVlM2Q3MmE2YjZkZDI3MmY1ZmMxNjk2YTFjOA==:eyJzY29wZSI6InRlc3QiLCJkZWFkbGluZSI6IjE0NzIxNzY2MzQwMDAiLCJvdmVyd3JpdGUiOjAsImZzaXplTGltaXQiOjAsImluc3RhbnQiOjAsInNlcGFyYXRlIjowfQ==" --url 'http://updomain.com/file/upload'