Javascript Reference v2.0

Upload to a signed URL

Upload a file with a token generated from createSignedUploadUrl.

  • RLS policy permissions required:
    • buckets table permissions: none
    • objects table permissions: none
  • Refer to the Storage guide on how access control works
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.

    token
    REQUIRED
    string

    The token generated from createSignedUploadUrl

    fileBody
    REQUIRED
    FileBody

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

    fileOptions
    Optional
    FileOptions

const { data, error } = await supabase
  .storage
  .from('avatars')
  .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)