For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

Swift: Upload a file

Examples

Upload file

let fileName = "avatar1.png"

let object = try await supabase.storage
  .from("avatars")
  .upload(
    path: "public/\(fileName)",
    data: fileData,
    options: UploadOptions(
      contentType: "image/png",
      cacheControl: .maxAge(.seconds(3600)),
      upsert: false
    )
  )

Upload file from disk

let fileURL = URL(fileURLWithPath: "/path/to/avatar1.png")

try await supabase.storage
  .from("avatars")
  .upload(path: "public/avatar1.png", fileURL: fileURL)