This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @uppy/aws-s3@5.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/companion-client@5.1.1 - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/companion@6.1.1 ### Patch Changes -6a60ee5: Reject request early instead of crashing on missing `filename` for /s3/multipart and /s3/params endpoints ## @uppy/companion-client@5.1.1 ### Patch Changes -0c16fe4: - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/components@1.0.4 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Move `restore-confirmed` from `onUploadStart` event listener to `startUpload`, else it would cause `restore-confirmed` to be triggered even if there is no `recoveredState` to recover - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/image-editor@4.0.2 ## @uppy/compressor@3.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/core@5.1.1 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`) - Introduce new field `progress`.`complete`: if there is a post-processing step, set it to `true` once post processing is complete. If not, set it to `true` once upload has finished. - Throw a proper `Nonexistent upload` error message if trying to upload a non-existent upload, instead of TypeError - Rewrite `Uppy.upload()` - this fixes two bugs: 1. No more duplicate emit call when this.#restricter.validateMinNumberOfFiles throws (`#informAndEmit` and `this.emit('error')`) 2. 'restriction-failed' now also gets correctly called when `checkRequiredMetaFields` check errors. - Don't re-upload completed files #5930 - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Remove TagFile type - Use UppyFile instead. - Make `name` required on UppyFile (it is in reality always set) - Fix bug: `RestrictionError` sometimes thrown with a `file` property that was _not_ a `UppyFile`, but a `File`. This would happen if someone passed a `File` instead of a `MinimalRequiredUppyFile` into `core.addFile` (which is valid to do according to our API) - Improve some log messages - Simplify Uppy `postprocess-complete` handler - Updated dependencies [0c16fe4] - @uppy/utils@7.1.1 ## @uppy/dashboard@5.0.3 ### Patch Changes -0c16fe4: - Remove `restore-canceled` event as it was not being used. - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 - @uppy/provider-views@5.1.1 - @uppy/thumbnail-generator@5.0.2 ## @uppy/golden-retriever@5.1.1 ### Patch Changes -0c16fe4: - **Internal inter-package breaking change:** Remove hacky internal event `restore:get-data` that would send a function as its event data (to golden retriever for it to call the function to receive data from it). Add instead `restore:plugin-data-changed` that publishes data when it changes. This means that **old versions of `@uppy/transloadit` are not compatible with newest version of `@uppy/golden-retriever` (and vice versa)**. - Large internal refactor of Golden Retriever - Use `state-update` handler to trigger save to local storage and blobs, instead of doing it in various other event handlers (`complete`, `upload-success`, `file-removed`, `file-editor:complete`, `file-added`). this way we don't miss any state updates. also simplifies the code a lot. this fixes: - Always store blob when it changes - this fixes the bug when using the compressor plugin, it would store the uncompressed original blob (like when using image editor plugin) - Add back throttle: but throttling must happen on the actual local storage save calls inside MetaDataStore, _not_ the handleStateUpdate function, so we don't miss any state updates (and end up with inconsistent data). Note that there is still a race condition where if the user removes a file (causing the blob to be deleted), then quickly reloads the page before the throttled save has happened, the file will be restored but the blob will be missing, so it will become a ghost. this is probably not a big problem though. need to disable throttling when running tests (add it as an option to the plugin) - Fix implicit `any` types in #restore filesWithBlobs - Don't error when saving indexedDB file that already exists (make it idempotent) - Fix bug: Golden Retriever was not deleting from IndexedDbStore if ServiceWorkerStore exists, causing a storage leak - Remove unused Golden Retriever cleanup.ts - Clean up stored files on `complete` event _only_ if _all_ files succeeded (no failed files). this allows the user to retry failed files if they get interrupted - fixes #5927, closes #5955 - Only set `isGhost` for non-successful files - it doesn't make sense for successfully uploaded files to be ghosted because they're already done. #5930 - Add `upload-success` event handler `handleFileUploaded`: this handler will remove blobs of files that have successfully uploaded. this prevents leaking blobs when an upload with multiple files gets interrupted (but some files have uploaded successfully), because `#handleUploadComplete` (which normally does the cleanup) doesn't get called untill _all_ files are complete. - Fix `file-editor:complete` potential race condition: it would delete and add at the same time (without first awaiting delete operation) - Fix: Don't double `setState` when restoring - Improve types in golden retriever and MetaDataStore - MetaDataStore: move old state expiry to from `constructor` to `load()` - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/image-editor@4.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/provider-views@5.1.1 ### Patch Changes -0c16fe4: - Rename `getTagFile` to `companionFileToUppyFile` - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/thumbnail-generator@5.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/transloadit@5.1.3 ### Patch Changes -0c16fe4: - **Internal inter-package breaking change:** Remove hacky internal event `restore:get-data` that would send a function as its event data (to golden retriever for it to call the function to receive data from it). Add instead `restore:plugin-data-changed` that publishes data when it changes. This means that **old versions of `@uppy/transloadit` are not compatible with newest version of `@uppy/golden-retriever` (and vice versa)**. - Minor internal refactoring in order to make sure that we will always emit `restore:plugin-data-changed` whenever assembly state changes - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/companion-client@5.1.1 - @uppy/core@5.1.1 - @uppy/utils@7.1.1 - @uppy/provider-views@5.1.1 - @uppy/tus@5.0.2 ## @uppy/tus@5.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/companion-client@5.1.1 - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/url@5.0.2 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`). This means we have to add null checks in some packages - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/companion-client@5.1.1 - @uppy/core@5.1.1 - @uppy/utils@7.1.1 ## @uppy/utils@7.1.1 ### Patch Changes -0c16fe4: - Make `file.data` nullable - Because for ghosts it will be `undefined` and we don't have any type to distinguish ghosts from other (local) files. This caused a crash, because we didn't check for `undefined` everywhere (when trying to store a blob that was `undefined`) - Introduce new field `progress`.`complete`: if there is a post-processing step, set it to `true` once post processing is complete. If not, set it to `true` once upload has finished. - Throw a proper `Nonexistent upload` error message if trying to upload a non-existent upload, instead of TypeError - Rewrite `Uppy.upload()` - this fixes two bugs: 1. No more duplicate emit call when this.#restricter.validateMinNumberOfFiles throws (`#informAndEmit` and `this.emit('error')`) 2. 'restriction-failed' now also gets correctly called when `checkRequiredMetaFields` check errors. - Don't re-upload completed files #5930 - Split UppyFile into two intefaces distinguished by the `isRemote` boolean: - LocalUppyFile - RemoteUppyFile - Remove TagFile type - Use UppyFile instead. - Make `name` required on UppyFile (it is in reality always set) - Fix bug: `RestrictionError` sometimes thrown with a `file` property that was _not_ a `UppyFile`, but a `File`. This would happen if someone passed a `File` instead of a `MinimalRequiredUppyFile` into `core.addFile` (which is valid to do according to our API) - Improve some log messages - Simplify Uppy `postprocess-complete` handler ## uppy@5.1.7 ### Patch Changes - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - Updated dependencies [0c16fe4] - @uppy/aws-s3@5.0.2 - @uppy/companion-client@5.1.1 - @uppy/compressor@3.0.2 - @uppy/core@5.1.1 - @uppy/dashboard@5.0.3 - @uppy/golden-retriever@5.1.1 - @uppy/image-editor@4.0.2 - @uppy/provider-views@5.1.1 - @uppy/thumbnail-generator@5.0.2 - @uppy/transloadit@5.1.3 - @uppy/tus@5.0.2 - @uppy/url@5.0.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
3.3 KiB
Uppy
Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can
use this from a CDN
(<script src="https://releases.transloadit.com/uppy/v5.1.7/uppy.min.js"></script>)
or bundle it with your webapp.
Note that the recommended way to use Uppy is to install it with yarn/npm and use a bundler like Webpack so that you can create a smaller custom build with only the things that you need. More info on https://uppy.io/docs/#With-a-module-bundler.
How to use this bundle
You can extract the contents of this zip to a directory, such as ./js/uppy.
Now you can create an HTML file, for example ./upload.html, with the following
contents:
<html>
<head>
<link rel="stylesheet" href="./js/uppy/uppy.min.css" />
</head>
<body>
<div class="DashboardContainer"></div>
<button class="UppyModalOpenerBtn">Upload</button>
<div class="uploaded-files">
<h5>Uploaded files:</h5>
<ol></ol>
</div>
</body>
<script type="module">
import { Uppy, Dashboard, Tus } from './js/uppy/uppy.min.mjs'
var uppy = new Uppy({
debug: true,
autoProceed: false,
})
.use(Dashboard, {
browserBackButtonClose: false,
height: 470,
inline: false,
replaceTargetContent: true,
showProgressDetails: true,
target: '.DashboardContainer',
trigger: '.UppyModalOpenerBtn',
metaFields: [
{ id: 'name', name: 'Name', placeholder: 'file name' },
{
id: 'caption',
name: 'Caption',
placeholder: 'describe what the image is about',
},
],
})
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })
.on('upload-success', function (file, response) {
var url = response.uploadURL
var fileName = file.name
document.querySelector('.uploaded-files ol').innerHTML +=
'<li><a href="' + url + '" target="_blank">' + fileName + '</a></li>'
})
</script>
</html>
Now open upload.html in your browser, and the Uppy Dashboard will appear.
Next steps
In the example you built, Uppy uploads to a demo server where files will be
deleted shortly after uploading. You’ll want to target your own tusd server, S3
bucket, or Nginx/Apache server. For the latter, use the Xhr plugin:
https://uppy.io/docs/xhr-upload/ which uploads using regular multipart form
posts, that you’ll existing Ruby or PHP backend will be able to make sense of,
as if a <input type="file"> had been used.
The Dashboard now opens when clicking the button, but you can also draw it inline into the page. This, and many more configuration options can be found here: https://uppy.io/docs/dashboard/.
Uppy has many more Plugins besides Xhr and the Dashboard. For example, you can enable Webcam, Instagram, or video encoding support. Note that for some Plugins, you will need to run a server side component called: Companion. Those plugins are marked with a (c) symbol. Alternatively, you can sign up for a free Transloadit account. Transloadit runs Companion for you, tusd servers to handle resumable file uploads, and can post-process files to scan for viruses, recognize faces, etc. Check: https://transloadit.com.
Getting help
Stuck with anything? We’re welcoming all your questions and feedback over at https://community.transloadit.com/c/uppy/5.