uppy/website/src/api-usage-example.ejs
2016-11-25 13:58:11 -06:00

21 lines
781 B
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Uppy from 'uppy/lib/core'
import Dashboard from 'uppy/lib/plugins/Dashboard'
import Tus10 from 'uppy/lib/plugins/Tus10'
import Informer from 'uppy/lib/plugins/Informer'
import MetaData from 'uppy/lib/plugins/MetaData'
 
const uppy = Uppy({autoProceed: false})
.use(Dashboard, {trigger: '#select-files'})
.use(Informer, {target: Dashboard})
.use(Tus10, {endpoint: '://master.tus.io/files/'})
.use(MetaData, {
fields: [
{ id: 'resizeTo', name: 'Resize to', value: 1200, placeholder: 'specify future image size' },
{ id: 'description', name: 'Description', value: 'none', placeholder: 'describe what the file is for' }
]
})
.run()
 
uppy.on('core:success', (fileCount) => {
console.log(`Upload complete. We uploaded ${fileCount} files!`)
})