mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 23:19:23 +08:00
Resumable Uploads with Supabase Storage and Uppy
This example shows how to use signed urls from Supabase Storage with Uppy to upload files to Supabase Storage using the TUS protocol (signed resumable uploads).
This works by calling createSignedUploadUrl() to get a token for each file, and passing that token via the x-signature header when uploading the files
Running the example
- Start local supabase project
supabase start - Open the index.html file and set
SUPABASE_PUBLISHABLE_KEYto the value output when starting the supabase cli - Serve the index.html file locally (e.g. with Python Simple HTTP Server or http-server npm package) and start uploading:
# python http server
python3 -m http.server
# npm http-server
npx http-server
How it works
In index.html the uppy.on('file-added') hook calls the create-upload-token function which creates a token for each added file and attaches it to that file's header config as x-signature.