I am developing an Angular application with the Kendo Upload control and I require the ability to send custom messages to the control's file list. Here is my current code to add ModelState errors to the validationErrors array of the affected file.
errorEventHandler(upload: any, e: ErrorEvent): void {
const file = e.files[0];
file.validationErrors = [];
if (e.response.status !== 400 || !e.response.statusText) {
file.validationErrors.push('failedToUpload');
return;
}
let response: any = e.response;
if (response) {
var modelState = response.error.ModelState;
for (var key in modelState) {
if (modelState.hasOwnProperty(key)) {
file.validationErrors.push(key);
}
}
}
}
How can I make the control's error field show my own message instead of the default "File Failed to Upload."?