Skip to content

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/shares/{token}/uploads

Parameters

Path parameters

ParameterTypeRequiredDescription
tokenstringyes-

Body parameters

ParameterTypeRequiredDescription
namestringyesThe file name, must be the same for all file chunks
chunkfileyesThe file or part of the file as a chunk
extensionstringyesThe file extension
is_last_chunkbooleanyesDetermine if the sending file or chunk is the last one in upload queue
pathstringyesThe 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_iduuidnoThe uuid of the parent folder. If it's not set, then the files will be uploaded into home location

Request example

sh
curl --location --request POST 'https://files.ro/api/v1/shares/{token}/uploads' \
--header 'Content-Type: multipart/form-data' \
--form 'name=filesro-hero' \
--form 'chunk=@/path/to/file' \
--form 'extension=jpg' \
--form 'is_last_chunk=1' \
--form 'path=/tru/man/mora/'

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": "Access Denied"
}