Flutter: Upload a file

Uploads a file to an existing bucket.

Parameters

Examples

Upload file

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

Upload file on web

final Uint8List avatarFile = file.bytes;
final String fullPath = await supabase.storage.from('avatars').uploadBinary(
      'public/avatar1.png',
      avatarFile,
      fileOptions: const FileOptions(cacheControl: '3600', upsert: false),
    );