curl -X POST https://img.sicxs.cn/api/v1/upload \
-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://img.sicxs.cn/api/v1/upload');
$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://img.sicxs.cn/api/v1/upload', {
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://img.sicxs.cn/api/v1/upload'
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())