Duplicate File handling in ejs uploader

Hi,

I m using ejs uloader for my Angular 8 project.

Can you please tell how to handle the duplicate file upload as in the demo, it doesn't do anything if I try to upload a file again.
I want to show the message in case of duplicate file upload, and then give option to upload file again after deleting.

Thanks & Regards,
Ankit Pathak

2 Replies

PM Ponmani Murugaiyan Syncfusion Team April 6, 2020 12:53 PM UTC

Hi Ankit, 

Currently we are validating the reported issue. Will update further details shortly. 

Regards, 
Ponmani M 



PM Ponmani Murugaiyan Syncfusion Team April 6, 2020 02:17 PM UTC

Hello Ankit, 

Greetings from Syncfusion support. 

As per your requirement, we have prepared stackblitz sample and shown the alert message while uploading the duplicate file. Please find the code snippet and sample below for reference. 

[app.component.ts] 
 
public onFileSelect(args : any) { 
    let existingFiles: FileInfo[] = this.uploadObj.getFilesData(); 
    for (let i: number = 0; i < args.filesData.length; i++) { 
        for(let j: number = 0; j < existingFiles.length; j++) { 
            if (!isNullOrUndefined(args.filesData[i])) { 
                if (existingFiles[j].name == args.filesData[i].name) { 
                    args.filesData.splice(i, 1); 
                    alert("Duplicate files are not allowed"); 
                } 
            } 
        } 
    } 
    existingFiles = existingFiles.concat(args.filesData); 
    args.modifiedFilesData = existingFiles; 
    args.isModified = true; 
} 


 
Kindly check with the above sample meets your requirement. If not please get back us with more information, we will assists you further. 
 
Regards, 
Ponmani M 


Loader.
Up arrow icon