Upload a file for temporary storage.

To upload a file, you need to generate its UUID and pass it as the hash request parameter. It will be used as the file body ID.
You can upload a file in full or in parts. To upload the whole file, pass the Content-Range header with the value bytes 0-[size]/[size] (for example, bytes 0-1000/1000).

To upload a file in parts, you need to divide the file. All parts must be of equal size, except for the last one. The size of the main parts must be between 5 MB (5 242 880 B) and 5 GB (5 368 709 120 B). The remaining part can be of any size.

To inform the server which of the parts is being uploaded, you need to pass the Content-Range header. It is set by the following template: bytes [range-start]-[range-end]/[size]. For example, to upload a 7 MB file, you’d need to pass the following headers: bytes 0-5242880/7340032 for the first 5 MB part of the file and bytes 5242880-7340032/7340032 for the remaining part.

Then you need to initialize the file. Otherwise, it will be deleted as unneeded. A temporary file is stored in the system for 60 minutes. You can initialize it using the /disk/file/move endpoint, moving it to a directory or saving within an app using the /app/{namespace}/{code}/create или /app/{namespace}/{code}/create or /app/{namespace}/{code}/{id}/update endpoints.

The Content-Type header must have the value application/octet-stream. In the request body, binary data is passed.

Request

POST /pub/v1/disk/file/upload

Query parameters

Parameter name Value Description Additional
hash uuid

Hash of the file that is going to be uploaded in parts

Required

Form parameters

Parameter name Value Description Additional
file file

name: File
Uploaded 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 is fully uploaded

206 Partial Content

Part of the file is successfully uploaded

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 small; InvalidPart if 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

default

Response after one of the file parts is uploaded

Response after one of the file parts is uploaded (Upload a temporary file)