File Upload
Upload Stream
Upload a local file directly to object storage via multipart/form-data
Authorization
BearerAuth
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
In: header
Request Body
multipart/form-data
file*file
二进制文件数据
Format
binaryupload_path?string
自定义子目录,自动加 temp/ 前缀;禁止 .. 越级
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://loading/api/common/upload/stream" \ -F file="string"{
"success": true,
"code": 200,
"msg": "File uploaded successfully",
"data": {
"file_id": "872defd8180ee9c6d32265ef4e8d255b",
"file_name": "1735471744123456789_a8b9cd2e.png",
"original_name": "cat.png",
"file_size": 3242,
"mime_type": "image/png",
"upload_path": "temp/demo/2025/12/29",
"file_url": "https://cdn.your-platform.com/temp/demo/2025/12/29/1735471744123456789_a8b9cd2e.png",
"download_url": "https://cdn.your-platform.com/temp/demo/2025/12/29/1735471744123456789_a8b9cd2e.png",
"upload_time": "2025-12-29T13:09:04.731057",
"expires_at": "2026-01-01T13:09:04.731057"
}
}{
"detail": "Invalid file data"
}{
"detail": "Invalid file data"
}{
"detail": "Invalid file data"
}{
"detail": [
{
"loc": [
"body",
"file"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}{
"detail": "Invalid file data"
}{
"detail": "Invalid file data"
}How is this guide?
Last updated on