Closed florianmascaro closed 4 months ago
Today, it's not possible to upload multiple files at a time directly with the upchunk
library.
Thank you for your answer. I hope it will be possible soon.
Why not used loop trough the files and call UpChunk.createUpload
for each file?
const picker = document.getElementById('picker');
picker.onchange = () => {
for (var i = 0; i < picker.files.length; i++) {
const file = picker.files[i];
const upload = UpChunk.createUpload({
endpoint: '/upload/' + file.name,
file,
chunkSize: 30720,
dynamicChunkSize: false,
});
// subscribe to events
upload.on('error', err => {
console.error(`${file.name}: It all went wrong!`, err.detail);
});
upload.on('progress', ({ detail: progress }) => {
console.log(`${file.name}: Progress: ${progress}%`);
});
upload.on('attempt', ({ detail }) => {
console.log(`${file.name}: There was an attempt!`, detail);
});
upload.on('attemptFailure', ({ detail }) => {
console.log(`${file.name}: The attempt failed!`, detail);
});
upload.on('chunkSuccess', ({ detail }) => {
console.log(`${file.name}: Chunk successfully uploaded!`, detail);
});
upload.on('success', () => {
console.log(`${file.name}: We did it!`);
});
}
};
Closing due to inactivity. The suggestion from @Yavari should be sufficient to solve issue with current upchunk architecture (thank you!). Can reopen or create a new issue if needed.
Is the a way to upload multiples files at the same time with UpChunk.createUpload of a Direct uploads and not just the files[0] ?
here is my code :