Loading Depth Study
Preparing your workspace
Supabase Storage provides object storage for files such as images, documents, videos, and other application assets.
Storage uses buckets to organize files. Files can be uploaded, listed, moved, and removed using the Supabase client or server-side tools. Public buckets allow broad access to files, while private buckets require controlled access through appropriate mechanisms such as signed URLs or authenticated access patterns. Storage policies should be designed carefully so users cannot access files belonging to other users or organizations.
A learning platform can store profile pictures, course thumbnails, certificates, and assignment documents in different storage buckets.
const filePath = `profiles/${userId}/avatar.png`;
const { error } = await supabase.storage
.from('avatars')
.upload(filePath, file, {
upsert: true
});
if (error) {
throw error;
}The file is uploaded into the avatars bucket under the user's profile path.