© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
ven

Not able to upload avatar to storage bucket using formidable

I am building an app in Nuxt 3 and trying to upload an avatar to the storage bucket through an api call to my server. i parse the files using formidable like so
    const form = formidable({ multiples: true });
    const client = await serverSupabaseClient(event);

    const response = await new Promise((resolve, reject) => {
        form.parse(event.req, (err, fields, files) => {
            if (err) {
                reject(err);
            }
            resolve({ fields, files });
        });
    });
    const { fields, files } = response;
    const form = formidable({ multiples: true });
    const client = await serverSupabaseClient(event);

    const response = await new Promise((resolve, reject) => {
        form.parse(event.req, (err, fields, files) => {
            if (err) {
                reject(err);
            }
            resolve({ fields, files });
        });
    });
    const { fields, files } = response;
and then i rename my file removing any blank spaces
    const fileName = encodeURIComponent(
        files.avatar.originalFilename.replace(/\s/g, '-')
    );
    const fileName = encodeURIComponent(
        files.avatar.originalFilename.replace(/\s/g, '-')
    );
and try to upload the file
    // upload the file to supabase storage
    const { data, error } = await client.storage
        .from('site')
        .upload('public/' + Date.now() + '-' + fileName, files.avatar);
    return data;
    // upload the file to supabase storage
    const { data, error } = await client.storage
        .from('site')
        .upload('public/' + Date.now() + '-' + fileName, files.avatar);
    return data;
i get no error and there is no file in storage. any thoughts on what could be happening?
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

Not able to download files from storage bucket
SupabaseSSupabase / help-and-questions
2mo ago
not able to upload files to supabase storage bucket. this is the policy i have
SupabaseSSupabase / help-and-questions
3y ago
Unable to upload file to a storage bucket.
SupabaseSSupabase / help-and-questions
4y ago
Upload avatar to profile
SupabaseSSupabase / help-and-questions
4y ago