Skip to content

Commit

Permalink
fixed multipart upload
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-formio committed Nov 1, 2023
1 parent 877b2c7 commit c54e953
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/file/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,24 @@ export default class FileComponent extends Field {
}
}

getMultipartOptions(fileToSync) {
let count = 0;
return this.component.useMultipartUpload && this.component.multipart ? {
...this.component.multipart,
progressCallback: (total) => {
count++;
fileToSync.status = 'progress';
fileToSync.progress = parseInt(100 * count / total);
delete fileToSync.message;
this.redraw();
},
changeMessage: (message) => {
fileToSync.message = message;
this.redraw();
},
} : false;
}

async uploadFile(fileToSync) {
return await this.fileService.uploadFile(
fileToSync.storage,
Expand All @@ -1031,6 +1049,7 @@ export default class FileComponent extends Field {
id: fileToSync.id,
abort,
}),
this.getMultipartOptions(fileToSync),
);
}

Expand Down

0 comments on commit c54e953

Please sign in to comment.