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) {
// handle restrictions
console.log('Restriction error:', err)
} else {
// handle other errors
console.error(err)
}
}
})
})
// it’s probably a good idea to clear the `<input>`
// after the upload or when the file was removed
// (see https://github.com/transloadit/uppy/issues/2640#issuecomment-731034781)
uppy.on('file-removed', () => {
fileInput.value = null
})
uppy.on('complete', () => {
fileInput.value = null
})
Also in JavaScript:
- how to find out which version of React
- get number of creeps screeps
- material ui icon button
- i18n react meta description
- watchman watch-del-all, and react-native start --reset-cache
- moving a item fro index to another index, javascript
- angular generat model
- what is download api javascript
- indexing string in javascript
- javascript convert binary to text
- length of list in javascript
- angular interview questions
- refresh page on button click jquery
- button style in jquery datatable
- output angular
- node js read file from s3 bucket
- chartjs start at 0
- kendo grid add line javascript
- vs code terminal json object not showing something shows [object]
- ng g c
- vuejs how use this.$slots.default
- javascript detect browser
- default value of functin atribute
- Unexpected end of JSON input while parsing near '...fcd15e632426a1be","ta'