2021-02-1.26.md 2.9 KB


title: "Uppy 1.26: Dashboard “disabled”, per-file headers" date: 2021-02-26 author: arturi image: "https://uppy.io/images/blog/1.26/dashboard-disabled.jpg"

published: true

Uppy 1.26 brings a new disabled option for the Dashboad, ability to set headers per file with XHR Upload, and fixes for the Transloadit plugin.

Uppy Dashboard UI with disabled state

Dashboard “Disabled”

You can now specify a disabled option for the Dashboard, in order to make it non-interactive and grayed out. Users won’t be able to click on buttons or drop files.

This is useful when you need to confitionally enable/disable file uploading or manipulation, based on a condition in your app.

Your browser does not support the video tag: https://uppy.io/images/blog/images/blog/1.26/dashboard-disabled-vs-enabled.mp4

This option can be set on init:

uppy.use(Dashboard, {
  disabled: true,
})

and via API:

const dashboard = uppy.getPlugin('Dashboard')
dashboard.setOptions({ disabled: true })

userNameInput.addEventListener('change', () => {
  dashboard.setOptions({ disabled: false })
})

See the docs.

XHR Upload Per File headers

@uppy/xhr-upload now accept a headers: (file) => {} function, so you can do:

uppy.use(XHRUpload, {
  headers: file => ({
    'authorization': `bearer ${global.userToken}`,
    'header-name': file.meta.someMetaValue,
  }),
})

to determine file-specific headers.

The function syntax for headers is only available if the bundle option is false (the default). bundle uploads share only one set of headers.

Build System Improvements

  • build: set legacy-peer-deps for npm 7. We have some peerDependency mismatches in our install tree. In npm 6 this was OK (maybe reason for a warning) but in npm 7 they hard fail the install
  • build: added npm version check (33e656cad3 / @goto-bus-stop)

Transloadit Plugin

  • Fixed a case where the plugin used stale file data.
  • Fixed polling fallback bugs.
  • Url concatenation is now more robust.

Misc

See changelog for details.