Hello,
I'm using Kendo UI for Angular's Upload component and implementing a custom upload mechanism via the upload event handler. The goal is to post the file before form submit (reactive form dynamically generated) and on submit only filename will be passed to form).
The problem is that although I've implemented custom upload handler, component is trying to post the file (at least I see POST to localhost in network tab)? Solved this with `e.preventDefault()` which uploads file correctly, but file is removed from kendo-upload and there is no info if it's uploaded.
<kendo-upload
[multiple]="false"
(upload)="uploadEventHandler($event)">
</kendo-upload>
uploadEventHandler(e: UploadEvent) {
this.file = e.files[0].rawFile;
this.uploadStatus = 'uploading';
this.fileUploadService.mediaUpload(this.file, this.question).subscribe({
next: () => {
this.uploadStatus = 'success';
this.control.setValue(this.file?.name);
},
error: (error: any) => {
this.uploadStatus = 'error';
this.errorMessage = this.getUserFriendlyErrorMessage(error);
},
});
e.preventDefault();
}