Swift: Upload a file
- RLS policy permissions required:
buckets table permissions: none
objects table permissions: only insert when you are uploading new files and select, insert and update when you are upserting files
- Refer to the Storage guide on how access control works
Examples
Upload file
let fileName = "avatar1.png"
try await supabase.storage
.from("avatars")
.upload(
path: "public/\(fileName)",
file: fileData,
options: FileOptions(
cacheControl: "3600",
contentType: "image/png",
upsert: false
)
)