Upload a File
POST/api/files
The filename sent by the client is never used as given: it is reduced to its basename, rewritten to a strict character whitelist, length capped, then validated against the RISE core extension allowlist before the core move_temp_file() gives it a unique prefix.
Headers
| Field | Type | Description |
|---|---|---|
| authtoken | String | Authentication token, generated from admin area |
| Content-Type | String | multipart/form-data |
Parameters
| Field | Type | Description |
|---|---|---|
| file | File | Mandatory file part. The extension must be listed in the RISE "accepted file formats" setting; PHP extensions are always refused. Maximum 25 MB. |
| context | String | Mandatory context. One of: project, client, global, user. |
| context_id | Number | optional Mandatory for project (project ID), client (client ID) and user (RISE user ID). Ignored for global. |
| folder_id | Number | optional Optional destination folder ID. Default 0, meaning the root of the context. |
| category_id | Number | optional Optional file category ID. Project context only. |
| description | String | optional Optional description stored with the file. |
| created_by | Number | optional Optional RISE user ID recorded as the uploader. Default: 1. |
curl -X POST "https://yoursite.com/api/files" \
-H "authtoken: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "file": "...", "context": "..." }' Success-Response:
HTTP/1.1 201 Created
{
"status": 200,
"messages": {"success": "The record has been saved."},
"id": 12,
"source": "project"
} Error-Response:
HTTP/1.1 400 Bad Request
{ "status": false, "messages": { "error": "File type is not allowed." } }