XHRUpload (Multipart) Example

Uppy recommends using tus resumable file uploads, but if you want you can also use XHRUpload (Multipart Form) uploads

Simple form with a file input, mounted to a fallback <form> container — works even without JavaScript or when something goes wrong (slow connection, JS errors, old browsers):

Uppy was not loaded — slow connection, unsupported browser, weird JS error on a page — but the upload still works, because HTML is cool like that

Console output (latest logs are at the top):

On this page we're using the following HTML snippet:

<!-- Basic Uppy styles -->
<link rel="stylesheet" href="https://unpkg.com/@uppy/file-input/dist/style.min.css">
<link rel="stylesheet" href="https://unpkg.com/@uppy/progress-bar/dist/style.min.css">

<div class="UppyForm">
  <form action="//api2.transloadit.com">
    <h5>Uppy was not loaded — slow connection, unsupported browser, weird JS error on a page — but the upload still works, because HTML is cool like that</h5>
    <input type="file" name="files[]" multiple="">
    <button type="submit">Fallback Form Upload</button>
  </form>
</div>

Along with this JavaScript:

const Uppy = require('@uppy/core')
const FileInput = require('@uppy/file-input')
const XHRUpload = require('@uppy/xhr-upload')
const ProgressBar = require('@uppy/progress-bar')

const uppy = new Uppy({ debug: true, autoProceed: true })
uppy.use(FileInput, { target: '.UppyForm', replaceTargetContent: true })
uppy.use(XHRUpload, {
  endpoint: '//api2.transloadit.com',
  formData: true,
  fieldName: 'files[]'
})
uppy.use(ProgressBar, {
  target: 'body',
  fixed: true,
  hideAfterFinish: false
})

console.log('Uppy with Formtag and XHRUpload is loaded')

Please see documentation for details.


Hey there stranger! Uppy is actively developed and the example section is our playground. Things might not work, but we're working hard to improve.

We're on a monthly release cycle and our latest version is v0.29.0, but the example pages reflect the latest work in our master branch. Here's what changed in master since v0.29.0 in terms of commits, while the CHANGELOG provides a higher level view of the things planned for our next release.

Files from the examples are uploaded to our test servers and deleted daily.