Files
supabase/examples/storage/resumable-upload-uppy/index.html
Chris Chinchilla d8bd6b047c docs: Examples Key changes (#45170)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Updated examples and guides to use Supabase publishable (client) keys
instead of anon keys for client-side usage across frameworks and
platforms.
* Renamed environment variable examples and .env templates to reflect
publishable key naming.
* Adjusted sample requests and client-init examples to send/use the
publishable key via the apikey header where applicable.
* Updated references from service_role to secret for server-side
credential guidance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: fadymak <fady@fadymak.com>
2026-05-04 12:58:16 +02:00

97 lines
2.7 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resumable Upload Supabase + UppyJS</title>
<link href="https://releases.transloadit.com/uppy/v3.6.1/uppy.min.css" rel="stylesheet" />
<style>
html {
background: #9e44ef;
}
body {
height: 100vh;
background: radial-gradient(72.03% 66.03% at 50% 69.72%, #dbb8bf 0, transparent 100%);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
a {
display: block;
margin: 10px;
text-decoration: none;
}
#logo {
max-width: 150px;
}
#drag-drop-area {
margin-top: 40px;
}
</style>
</head>
<body>
<img id="logo" src="supabase-logo-wordmark--dark.png" />
<div id="drag-drop-area"></div>
<a href="https://supabase.com/docs/guides/storage/uploads/resumable-uploads" target="_blank"
>Read the docs.</a
>
<script type="module">
import {
Uppy,
Dashboard,
Tus,
} from 'https://releases.transloadit.com/uppy/v3.6.1/uppy.min.mjs'
const SUPABASE_PUBLISHABLE_KEY = 'replace-with-your-publishable-key'
const SUPABASE_PROJECT_ID = 'replace-with-your-project-id'
const STORAGE_BUCKET = 'replace-with-your-bucket-id'
const BEARER_TOKEN='replace-with-your-bearer-token'
const folder = ''
const supabaseStorageURL = `https://${SUPABASE_PROJECT_ID}.supabase.co/storage/v1/upload/resumable`
var uppy = new Uppy()
.use(Dashboard, {
inline: true,
limit: 10,
target: '#drag-drop-area',
showProgressDetails: true,
})
.use(Tus, {
endpoint: supabaseStorageURL,
headers: {
authorization: `Bearer ${BEARER_TOKEN}`,
apikey: SUPABASE_PUBLISHABLE_KEY,
},
uploadDataDuringCreation: true,
chunkSize: 6 * 1024 * 1024,
allowedMetaFields: ['bucketName', 'objectName', 'contentType', 'cacheControl'],
onError: function (error) {
console.log('Failed because: ' + error)
},
})
uppy.on('file-added', (file) => {
const supabaseMetadata = {
bucketName: STORAGE_BUCKET,
objectName: folder ? `${folder}/${file.name}` : file.name,
contentType: file.type,
}
file.meta = {
...file.meta,
...supabaseMetadata,
}
console.log('file added', file)
})
uppy.on('complete', (result) => {
console.log('Upload complete! Weve uploaded these files:', result.successful)
})
</script>
</body>
</html>