Load a file to a directory
Uploading a file to the directory specified in the ID.
The file will be placed to the required directory, make sure you have enough disk space. If there already is a file with the same name in the directory, a prefix with a number will be added it it's name: (1), etc.
To upload the file, generate uuid and pass it as a unique hash value for the file's body.
To upload the entire file, use the Content-Range header with the following value: bytes 0-[size]\/[size] (for example, bytes 0-1000/1000).
You can also upload the file by parts. To do that, divide the file into equal parts of 5 MB minimum each. The last part can be of any size.
The size of each such part must be between 5 MB (5 242 880 byte) and 5 GB (5 368 709 120 byte).
Header template: bytes [range-start]-[range-end]\/[size] (for example, bytes 0-5242880/7340032 to upload the first part of 5 MB for a 7 MB file, and bytes 5242880-7340032/7340032 to upload the second part of this file).
Request
POST /pub/v1/disk/directory/{id}/upload
Path parameters
Parameter name | Value | Description | Additional |
---|---|---|---|
id | uuid | name: id |
Required |
Query parameters
Parameter name | Value | Description | Additional |
---|---|---|---|
Hash | uuid | File body ID |
Required |
Form parameters
Parameter name | Value | Description | Additional |
---|---|---|---|
File | file | name: File |
Authorization
This request requires the use of one of following authorisation methods:
API key
Response
The following HTTP status codes may be returned.
Status code | Description | Resource |
---|---|---|
200 | OK The file has been loaded |
|
206 | Partial Content The part of the file has been loaded |
|
400 | Bad Request The error is shown as a message that describes the problem. The error message may contain the following codes: EntityTooSmall if the file is divided into parts that are too smal; InvalidPart is one of the parts was not found in storage; InvalidPartOrder if the order of the parts in the file is invalid; NoSuchUpload if the upload was not found. |
|
402 | Payment Required Not enough disk space |
|
403 | Forbidden No access permissions for creating a file |
|
default | Server response after the file is uploaded to the directory |
Server response after the file is uploaded to the directory (Load a file to a directory) |