File uploads and management with bucket-based storage
// Upload with FormData const formData = new FormData(); formData.append('file', fileInput.files[0]); fetch('/api/storage/buckets/avatars/objects', { method: 'POST', headers: { 'Authorization': `Bearer ${token}` }, body: formData }); // Response { url: "/api/storage/buckets/avatars/objects/file-123.jpg", size: 102400, contentType: "image/jpeg" }
/api/storage/buckets/{bucket}/objects/{filename}
resume.pdf
resume-1704067200-xyz789.pdf
// Image upload with preview async function uploadAvatar(file) { const formData = new FormData(); formData.append('file', file); const res = await fetch('/api/storage/buckets/avatars/objects', { method: 'POST', headers: { 'Authorization': `Bearer ${token}` }, body: formData }); const { url } = await res.json(); // Save URL to user profile await fetch('/api/database/records/profiles', { method: 'PATCH', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ avatar_url: url }) }); return url; }