© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
6 replies
Deleted User

How do I update a bucket path or upload if it doesn't already exist?

Right now I'm working on replacing user avatars if they don't already exist. The one problem with this is that update will fail if the file path doesn't exist. I wish it was smart enough to upload it to that path.

Is there a way to do this? I want to upload or update depending on if the file is there already.

      let { error } = await supabase.storage
        .from('avatars')
        .update('123456/avatar', formData);

      if (error) {
        console.log(error);
        return;
      }
      let { error } = await supabase.storage
        .from('avatars')
        .update('123456/avatar', formData);

      if (error) {
        console.log(error);
        return;
      }
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to know if a public url doesn't exist?
SupabaseSSupabase / help-and-questions
3y ago
Only INSERT if reservation doesn't exist yet.
SupabaseSSupabase / help-and-questions
4y ago
Snippet doesn't exist
SupabaseSSupabase / help-and-questions
6mo ago
How to handle email already exist
SupabaseSSupabase / help-and-questions
3y ago