Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
418 views
in Technique[技术] by (71.8m points)

Customize the error message of kendo upload with angular

I want to customize the error message displayed automatically by kendo upload when I upload a file which exceeds the maximum size.

 addedfiles : Array<any> = [];
 fileRestrictions: FileRestrictions = {
   allowedExtensions: ['.jpg', '.png', '.jpeg', '.doc', '.docx','.pdf'],
   maxFileSize: 5000000
 };
 public onSelect(ev: any): void { 
  ev.files.forEach((file: FileInfo) => {
 
  if (file.rawFile) {
    const reader = new FileReader();
    if(this.fileRestrictions.allowedExtensions.includes(file.extension.toLowerCase()))

    {reader.addEventListener('loadend', () => {
      this.addedfiles.push({ ...file, src: reader.result as string });
    });
    reader.readAsDataURL(file.rawFile);
  }

  }
});  
 }

HTML :

 <kendo-upload class="mobile-max-height-240" style="margin-top:2%;" (select)="onSelect($event)"
          (remove)="onRemove($event)" [restrictions]="fileRestrictions"></kendo-upload>

Here when I upload a file which exceed the maxFilesize the message : "file size too large" appear ! How can I change this message ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...