Skip to main content

POST /upload/{id}

Description

Uploads a new file

The route handles the HTTP PUT request made to the /upload/{id} path.

Parameters

id - (required) the id of a folder into which the file will be uploaded (representing the path to the folder)

Payload

The server needs to receive form-data with the next keys:

  • file (binary) - (required) a new file
  • name (string) - (required) the original file name of the uploaded file Only one file can be sent per request. If you want to upload multiple files simultaneously, they will be sent one file per request.

Example:

------WebKitFormBoundarylGvmmaWylhmBcS80
Content-Disposition: form-data; name="file"; filename="original-5033763-2.jpg"
Content-Type: image/jpeg


------WebKitFormBoundarylGvmmaWylhmBcS80

Response

The server returns a JSON object with new file id and new name:

Example:

{
"id": "/original-5033763-2.jpg",
"name": "original-5033763-2.jpg"
}

The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500). In case of a failure the error text is returned.


Related articles: