mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-29 04:50:05 +00:00
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/angular | 0.5.1 | @uppy/companion-client | 3.1.1 | | @uppy/aws-s3-multipart | 3.1.1 | @uppy/utils | 5.1.1 | | @uppy/companion | 4.1.1 | uppy | 3.3.1 | - @uppy/aws-s3-multipart: handle slow connections better (Antoine du Hamel / #4213) - @uppy/companion-client: treat `*` the same as missing header (Antoine du Hamel / #4221) - @uppy/utils: fix types (Antoine du Hamel / #4212) - @uppy/companion: send expire info for non-multipart uploads (Antoine du Hamel / #4214) - docs: fix `allowedMetaFields` documentation (Antoine du Hamel / #4216) - meta: add more bundlers for automated testing (Antoine du Hamel / #4100) - @uppy/aws-s3-multipart: Fix typo in url check (Christian Franke / #4211) - meta: use current version of packages when testing bundlers (Antoine du Hamel / #4208) - meta: do not use the set-output command in workflows (Antoine du Hamel / #4175)
58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Uppy</title>
|
||
<link href="https://releases.transloadit.com/uppy/v3.3.1/uppy.min.css" rel="stylesheet">
|
||
</head>
|
||
<body>
|
||
<div id="drag-drop-area"></div>
|
||
<script type="module">
|
||
import { Uppy, Dashboard, AwsS3 } from "https://releases.transloadit.com/uppy/v3.3.1/uppy.min.mjs"
|
||
var uppy = new Uppy()
|
||
.use(Dashboard, {
|
||
inline: true,
|
||
target: '#drag-drop-area',
|
||
})
|
||
.use(AwsS3, {
|
||
getUploadParameters (file) {
|
||
// Send a request to our PHP signing endpoint.
|
||
return fetch('/sign-s3', {
|
||
method: 'post',
|
||
// Send and receive JSON.
|
||
headers: {
|
||
accept: 'application/json',
|
||
'content-type': 'application/json',
|
||
},
|
||
body: JSON.stringify({
|
||
filename: file.name,
|
||
contentType: file.type,
|
||
}),
|
||
}).then((response) => {
|
||
// Parse the JSON response.
|
||
return response.json()
|
||
}).then((data) => {
|
||
// Return an object in the correct shape.
|
||
return {
|
||
method: data.method,
|
||
url: data.url,
|
||
fields: data.fields, // For presigned PUT uploads, this should be left empty.
|
||
// Provide content type header required by S3
|
||
headers: {
|
||
'Content-Type': file.type,
|
||
},
|
||
}
|
||
})
|
||
},
|
||
});
|
||
|
||
uppy.on('complete', (result) => {
|
||
console.log('Upload complete! We’ve uploaded these files:', result.successful)
|
||
})
|
||
|
||
uppy.on('upload-success', (file, data) => {
|
||
console.log('Upload success! We’ve uploaded this file:', file.meta['name'])
|
||
})
|
||
</script>
|
||
</body>
|
||
</html>
|