Secure, fast, and simple file storage for MyResto Today
This API allows you to upload various file types (images, documents, videos) and retrieve them via a permanent URL. Metadata is stored in a PostgreSQL database.
Base URL: https://files.myrestotoday.io
When a file is uploaded, it is saved to the uploads/ directory with a unique hashed name. Its metadata is stored in the file_uploads table:
| Column | Type | Description |
|---|---|---|
id |
SERIAL (PK) | Unique file ID (used for retrieval). |
stored_name |
VARCHAR | Unique filename on disk (e.g., 1706..._abc.jpg). |
original_name |
VARCHAR | The original name of the uploaded file. |
mime_type |
VARCHAR | MIME type (e.g., image/png, application/pdf). |
file_size |
BIGINT | File size in bytes. |
created_at |
TIMESTAMP | Upload timestamp. |
Files are not accessed directly to ensure security and metadata integrity. Instead, they are served via read.php:
read.php?id=123.Content-Type header (e.g., image/jpeg) based on the database record.This allows images to display inline in <img> tags and PDFs to open in the browser.
| Field | Type | Required | Description |
|---|---|---|---|
file |
File | Yes | The file object to upload (multipart/form-data). |
{
"status": "success",
"message": "File uploaded successfully",
"data": {
"id": 123,
"filename": "1706691234_abc123.jpg",
"original_name": "my-photo.jpg",
"url": "https://files.myrestotoday.io/read.php?id=123",
"direct_url": "https://files.myrestotoday.io/read.php?file=1706691234_abc123.jpg"
}
}
| Query Param | Example | Description |
|---|---|---|
id |
?id=123 |
Retrieve file by its Database ID (Recommended). |
file |
?file=name.jpg |
Retrieve by stored filename. |