This is a migrated thread and some comments may be shown as answers.

Validation not working

5 Answers 216 Views
Upload
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 09 Dec 2016, 06:15 PM

I have an upload object I am trying to use in an Angular app.  I have used the samples on the demo page and can not seem to get these items to work.  Below are both my HTML and the validation section from my javascript.

<input name="files" ng-model="vm.file" kendo-upload k-options="vm.uploadOpts" type="file" />
 
      vm.uploadOpts = {
        async: {
          saveUrl: "{0}FileManagement/Save".format(GMT.Config.baseApiUrl),
          autoUpload: true
        },
        validation: {
          maxFileSize: 304,
          allowedExtensions: ["upd", "txt", "xls", "doc", "docx", "xml", "xlsx", "csv", "xlsm"]
        },
        error: this.onError,
        success: this.onSuccess
      };

 

Why is it not utilizing this information?

5 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 12 Dec 2016, 08:44 AM

Hello James,

I am not sure what is causing the validation to not work on your end. Here is a small example that I used for testing. Could check it out and let me know if I am missing something?

Regards,
Dimiter Madjarov
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
0
James
Top achievements
Rank 1
answered on 12 Dec 2016, 04:16 PM

Thanks we are using a drag and drop upload with the dropzone class.  Now that I see what you sent, if I select a file it seems to work but if I drag and drop a file it does not.  Also, where can i find the error on failure in the error call back

 

0
Dimiter Madjarov
Telerik team
answered on 12 Dec 2016, 05:24 PM

Hello James,

I have tested the approach with a dropzone and a custom dropzone, but was unable to reproduce the issue on our end. Please send us an example (or modify the one that I sent in the previous post) in which we could observe the problem.

I am looking forward to hearing from you.

Regards,
Dimiter Madjarov
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
0
James
Top achievements
Rank 1
answered on 19 Dec 2016, 03:28 PM

Here is the entire form for the upload with the do

<form method="post" enctype="multipart/form-data" class="dropzone">
  <div class="dz-message">
    <input name="files" ng-model="vm.file" kendo-upload k-options="vm.uploadOpts" type="file" />
    <h5><span class="fa fa-cloud-upload"></span><br>{{'fileManager.upload.cta.MESSAGE' | translate}}</h5>
  </div>
</form>

 

this.uploadOpts = {
        async: {
          saveUrl: "{0}FileManagement/Save".format(GMT.Config.baseApiUrl),
          autoUpload: true
        },
        validation: {
          maxFileSize: 304,
          allowedExtensions: ["upd", "txt", "xls", "doc", "docx", "xml", "xlsx", "csv", "xlsm"]
        },
        error: this.onError,
        success: this.onSuccess
      };
0
Dimiter Madjarov
Telerik team
answered on 20 Dec 2016, 08:42 AM

Hello James,

Here a similar implementation, which is working as expected on our end. I am unable to observe the false behavior in this example. Could you modify it in order to reproduce the case?

Regards,
Dimiter Madjarov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Upload
Asked by
James
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
James
Top achievements
Rank 1
Share this question
or