uppy/BUNDLE-README.md
github-actions[bot] 6479159768
Release: uppy@3.16.0 (#4685)
| Package            | Version | Package            | Version |
| ------------------ | ------- | ------------------ | ------- |
| @uppy/companion    |   4.9.0 | @uppy/locales      |   3.3.1 |
| @uppy/compressor   |   1.0.3 | @uppy/tus          |   3.3.0 |
| @uppy/dashboard    |   3.5.3 | uppy               |  3.16.0 |
| @uppy/image-editor |   2.2.0 |                    |         |

- @uppy/tus: Fix: Utilize user-defined onSuccess, onError, and onProgress callbacks in @uppy/tus (choi sung keun / #4674)
- @uppy/dashboard: Make file-editor:cancel event fire when the Image Editor “cancel” button is pressed (Artur Paikin / #4684)
- @uppy/companion: add missing credentialsURL for box (Mikael Finstad / #4681)
- @uppy/companion: remove s3 endpoints if s3 disabled (Mikael Finstad / #4675)
- meta: use latest Node.js version for tests (Antoine du Hamel / #4662)
- meta: Improve Contributing.md (Evgenia Karunus / #4633)
- @uppy/compressor: update file.meta.name after compression, becase format/extension might have changed (Artur Paikin / #4645)
- @uppy/companion: Onedrive refresh tokens (Mikael Finstad / #4655)
- @uppy/companion: catch "invalid initialization vector" instead of crashing (Mikael Finstad / #4661)
- @uppy/image-editor: Improve image rotation (Evgenia Karunus / #4639)
- @uppy/locales: Feature/updating i18n farsi (Parsa Arvaneh / #4638)
2023-09-18 20:12:54 +00:00

3.3 KiB
Raw Blame History

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/v3.16.0/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>

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. Youll 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 youll 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. For a full list of Plugins check here: https://uppy.io/docs/plugins/.

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? Were welcoming all your questions and feedback over at https://community.transloadit.com/c/uppy/5.