Unggah file ke Kaminoa Uploader lewat API
Kirim request dengan Content-Type: multipart/form-data.
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
file | file | Ya | File yang ingin diunggah (maks. 50MB). |
upload_type | text | Tidak | temporary (default, dihapus dalam 1 jam) atau permanent. |
curl -X POST https://cloud.kaminoa.eu.cc/api.php \
-F "file=@/path/ke/file.jpg" \
-F "upload_type=temporary"
const form = new FormData();
form.append('file', fileInput.files[0]);
form.append('upload_type', 'permanent');
const res = await fetch('https://cloud.kaminoa.eu.cc/api.php', {
method: 'POST',
body: form,
});
const data = await res.json();
console.log(data.url);
import requests
with open('file.jpg', 'rb') as f:
res = requests.post(
'https://cloud.kaminoa.eu.cc/api.php',
files={'file': f},
data={'upload_type': 'temporary'},
)
print(res.json()['url'])
<?php
$ch = curl_init('https://cloud.kaminoa.eu.cc/api.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => new CURLFile('file.jpg'),
'upload_type' => 'temporary',
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data['url'];
{
"success": true,
"message": "File berhasil diunggah.",
"filename": "a1b2c3d4.jpg",
"url": "https://cloud.kaminoa.eu.cc/uploads/a1b2c3d4.jpg",
"size": 78745,
"type": "permanent",
"expires_in": null
}
{
"success": false,
"error": "Ukuran file terlalu besar. Maksimal 50MB."
}
Kode status yang mungkin: 400 (request salah), 405 (metode bukan POST), 413 (file terlalu besar), 500 (gagal simpan).