接口说明

POST https://sicxs.cn/order_config.php?upload_image

使用 multipart/form-data 表单上传,接口会中转图片至图床并返回图片 URL。

参数说明

参数名称 类型 是否必须 说明
?upload_image Query 触发上传模式,必须添加此参数。
file File 要上传的图片文件。支持 jpg, jpeg, png, gif, webp 等格式。
strategy_id Integer 图床存储策略 ID(默认值:1)。

调用示例

cURL
PHP
JS (Fetch)
Python
curl -X POST https://sicxs.cn/order_config.php \
  -H "Accept: application/json" \
  -H "Authorization: Bearer ***|your_token_here" \
  -F "file=@/path/to/your/image.jpg" \
  -F "strategy_id=1"
<?php
$ch = curl_init('https://sicxs.cn/order_config.php');
$postData = [
    'file' => new CURLFile('/path/to/your/image.jpg', 'image/jpeg', 'image.jpg'),
    'strategy_id' => 1
];

curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $postData,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Accept: application/json',
        'Authorization: Bearer ***|your_token_here'
    ]
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
print_r($data);
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('strategy_id', '1');

fetch('https://sicxs.cn/order_config.php', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer ***|your_token_here'
  },
  body: formData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests

url = 'https://sicxs.cn/order_config.php'
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer ***|your_token_here'
}
files = {
    'file': ('image.jpg', open('/path/to/your/image.jpg', 'rb'), 'image/jpeg')
}
data = {
    'strategy_id': '1'
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())

在线上传图片

点击或拖拽文件到这里上传
支持图片文件格式 (jpg, png, gif, webp)
返回结果 (JSON):
{}