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

Kendo Upload With Angular

1 Answer 453 Views
Upload
This is a migrated thread and some comments may be shown as answers.
jaditya
Top achievements
Rank 1
jaditya asked on 30 Oct 2020, 11:08 AM

Hi Team,

Thank you in advance in helping me with this issue.

In my project we are using the Kendo Upload control and its working as expected except one issue.

Issue:

If I drag a file and drop the same only single file is getting uploaded as (multiple set to false) but for the same single file api receiving two calls with same file name, which is causing duplicate entries in data base.

Note: This issue is happening only when I delete the uploaded file and refresh the form and then drag a file and drop it, also in the html we have two kendo-uploaddropzone controls along with kendo-upload, one for intial case where data is not available and other when data is available.

 <div *ngIf="currentAttachment && !currentAttachment.isDeleted" class="file-info-container">

 <kendo-uploaddropzone zoneId="singleUploadZone">
            <div class="text-container">
                <p>{{displayText1}}</p>
                <p>
                    {{displayText2}}
                    <a class="open-file-dialog-link" [class.disabled]="to.disabled" (click)="!to.disabled && startUploadFile(uploader)">{{displayText3}}</a>
                    {{displayText4}}
                </p>
            </div>

            <kendo-upload #uploader
                          [multiple]="false"
                          [restrictions]="restrictions"
                          [saveUrl]="uploadUrl"
                          [autoUpload]="true"
                          (success)="onSuccess($event)"
                          (error)="onError($event)"
                          (select)="uploadInfoSelect($event)"
                          [disabled]="to.disabled"
                          zoneId ="singleUploadZone"
                          kendoFileUpload>
                <kendo-upload-messages select="" [dropFilesHere]="displayText">
                </kendo-upload-messages>
            </kendo-upload>
        </kendo-uploaddropzone>

/>

 <div *ngIf="currentAttachment && !currentAttachment.isDeleted" class="file-info-container">

   <kendo-uploaddropzone zoneId="singleUploadZoneWithData">
            <div class="row">
                <div class="col-12">
                    <div class="text-container">
                        <p>{{displayText1}}</p>
                        <p>
                            {{displayText2}}
                            <a class="open-file-dialog-link" [class.disabled]="to.disabled" (click)="!to.disabled && startUploadFile(uploader)">{{displayText3}}</a>
                            {{displayText4}}
                        </p>
                    </div>
                    <kendo-upload #uploader
                                  [multiple]="to.multiple"
                                  [restrictions]="restrictions"
                                  [showFileList]="false"
                                  [saveUrl]="uploadUrl"
                                  [autoUpload]="true"
                                  (success)="onSuccess($event)"
                                  (error)="onError($event)"
                                  [disabled]="to.disabled"
                                  zoneId ="singleUploadZoneWithData"
                                  kendoFileUpload>
                    </kendo-upload>
                </div>
            </div>
        </kendo-uploaddropzone>

.ts

this function is called twice even though only one file is selected.
    public uploadInfoSelect(data) {
        console.log(data);
    }

/>

 

 

1 Answer, 1 is accepted

Sort by
0
Aditya
Top achievements
Rank 1
answered on 03 Nov 2020, 03:06 AM

Hi Team,

 

Is there any luck in helping me to fix the above mentioned issue.

 

Regards,

Aditya J

Tags
Upload
Asked by
jaditya
Top achievements
Rank 1
Answers by
Aditya
Top achievements
Rank 1
Share this question
or