File Chunks Upload
If you want to upload big files, sometimes you have to cut the files into many chunks and upload them one by one. This API endpoint gather these chunks and join them into one piece of file on the backend.
Endpoint
http
POST /api/v1/uploadsParameters
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The file name, must be the same for all file chunks |
chunk | file | yes | The file or part of the file as a chunk |
extension | string | yes | The file extension |
is_last_chunk | boolean | yes | Determine if the sending file or chunk is the last one in upload queue |
path | string | no | The directory path of the file. Use it when you'd like to upload folder and recreate folder structure in the backend. E.g. /Documents/Photos/wallpaper.jpg |
parent_id | uuid | no | The id of the parent folder. If id is not set, the files will be uploaded into home location |
Request example
sh
curl --location --request POST 'https://files.ro/api/v1/uploads' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer {token}' \
--form 'name=filesro-hero' \
--form 'chunk=@/path/to/file' \
--form 'extension=jpg' \
--form 'is_last_chunk=1'Response
json
{
"data": {
"id": "file_123",
"type": "file",
"attributes": {
"filesize": "1.2 MB",
"name": "report.pdf",
"basename": "report-uuid.pdf",
"mimetype": "application/pdf",
"file_url": "https://files.ro/file/report-uuid.pdf",
"thumbnail": "https://files.ro/thumbnail/report-uuid.jpg",
"parent_id": "folder_123",
"created_at": "01. Jan. 2024",
"updated_at": "02. Jan. 2024",
"deleted_at": null
},
"relationships": {
"shared": {
"data": {
"id": "share_123",
"type": "shared",
"attributes": {
"permission": "editor",
"protected": false,
"item_id": "item_123",
"expire_in": 24,
"token": "share_token",
"link": "https://files.ro/share/share_token",
"type": "folder"
}
}
},
"parent": {
"data": {
"type": "folder",
"id": "folder_123",
"attributes": {
"name": "Projects"
}
}
},
"creator": {
"data": {
"type": "creator",
"id": "user_123",
"attributes": {
"name": "Jane Doe",
"avatar": "https://files.ro/storage/avatars/jane.png",
"color": "#00BC7E"
}
}
},
"exif": {
"data": {
"type": "exif",
"id": "exif_123",
"attributes": {
"date_time_original": "2024-01-01",
"artist": "Jane Doe",
"height": 1080,
"width": 1920,
"x_resolution": "72",
"y_resolution": "72",
"color_space": "sRGB",
"camera": "Canon",
"model": "EOS",
"aperture_value": 2.8,
"exposure_time": "1/125",
"focal_length": "50mm",
"iso": 100,
"aperture_f_number": 2.8,
"ccd_width": "5.76mm",
"longitude": "0.0000",
"latitude": "0.0000"
}
}
}
}
}
}json
json
{
"type": "error",
"message": "You are not authorized"
}json
{
"message": "The given data was invalid.",
"errors": {
"field": [
"The field is required."
]
}
}