Home

Upload a file

Uploads a file to an existing bucket.

Uploads a file to an existing bucket.

  • Policy permissions required:
    • buckets permissions: none
    • objects permissions: insert
Parameters
  • path
    REQUIRED
    string

    The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.

  • fileBody
    REQUIRED
    object

    The body of the file to be stored in the bucket.

  • fileOptions
    Optional
    FileOptions

final avatarFile = File('path/to/file');
final String path = await supabase.storage.from('avatars').upload(
      'public/avatar1.png',
      avatarFile,
      fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
    );
Need some help?

Not to worry, our specialist engineers are here to help. Submit a support ticket through the Dashboard.