File Management
Interfaces for managing uploaded files.
Get File List
Get all uploaded files.
Interface Information
- Endpoint:
GET /api/admin/files - Authentication: Required (admin permission)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | No | Page number, default 1 |
| limit | number | No | Items per page, default 20 |
| type | string | No | File type filter: image/document/other |
Upload File
Upload single or multiple files.
Interface Information
- Endpoint:
POST /api/admin/files/upload - Authentication: Required (admin permission)
- Content-Type:
multipart/form-data
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| files | file | Yes | File (supports multiple) |
Request Example
bash
curl -X POST http://localhost:3000/api/admin/files/upload \
-H "Authorization: Bearer your-jwt-token" \
-F "files=@image1.jpg" \
-F "files=@document.pdf"Response Example
json
{
"success": true,
"data": [
{
"id": 1,
"filename": "image1.jpg",
"url": "https://example.com/uploads/image1.jpg",
"size": 102400,
"type": "image"
}
]
}Delete File
Delete specified file.
Interface Information
- Endpoint:
DELETE /api/admin/files/:id - Authentication: Required (admin permission)
Error Responses
| HTTP Status Code | Description |
|---|---|
| 401 | Not logged in or token invalid |
| 403 | Insufficient permission (non-admin) |
| 404 | File does not exist |
| 413 | File too large |
| 500 | Server error |
File Limits
- Single file maximum 10MB
- Supported image formats: jpg, jpeg, png, gif, webp
- Supported document formats: pdf, doc, docx, xls, xlsx