value of uppy input into another input to save code example
Example: uppy get data to input
const uppy = new Uppy(...)
const fileInput = document.querySelector('#my-file-input')
fileInput.addEventListener('change', (event) => {
const files = Array.from(event.target.files)
files.forEach((file) => {
try {
uppy.addFile({
source: 'file input',
name: file.name,
type: file.type,
data: file
})
} catch (err) {
if (err.isRestriction) {
console.log('Restriction error:', err)
} else {
console.error(err)
}
}
})
})
uppy.on('file-removed', () => {
fileInput.value = null
})
uppy.on('complete', () => {
fileInput.value = null
})