Skip to content

Instantly share code, notes, and snippets.

@isratmir
Created May 2, 2021 11:59
Show Gist options
  • Save isratmir/f49497a0e3769a9916c03181a0870ac2 to your computer and use it in GitHub Desktop.
Save isratmir/f49497a0e3769a9916c03181a0870ac2 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Uppy</title>
<link href="https://releases.transloadit.com/uppy/v1.27.0/uppy.min.css" rel="stylesheet">
</head>
<body>
<div id="drag-drop-area"></div>
<script src="https://releases.transloadit.com/uppy/v1.27.0/uppy.min.js"></script>
<script>
var uppy = Uppy.Core()
.use(Uppy.Dashboard, {
inline: true,
target: '#drag-drop-area'
})
.use(Uppy.Tus, {
endpoint: 'https://api.cloudflare.com/client/v4/accounts/{accountID}/media',
headers: {
'Authorization': `Bearer {token}`,
},
autoRetry: false,
chunkSize: 5242880
});
uppy.on('complete', (result) => {
console.log('Upload complete! We’ve uploaded these files:', result.successful)
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment