How to check that the files have already been sent.

I have

<ejs-uploader id="UploadFiles" dropArea=".control-fluid" actionComplete="onComplete" success="onSuccess" asyncSettings="@asyncSettings" autoUpload="false" buttons="@uploadBottuns">

User clicks a button and the files are sent using:

let uploadFiles = document.getElementById('UploadFiles').ej2_instances[0];

uploadFiles.upload(uploadFiles.getFilesData());
uploadFiles.clearAll();

And I would like to know when the files upload is finished.

The onComplete and onSuccess methods are not called.

The files are sent correctly.

I need to know when the upload of all files finished.



5 Replies

KP Kokila Poovendran Syncfusion Team February 20, 2024 11:02 AM UTC

Hi Karol Zynda,

Thank you for reaching out to us regarding your concerns with file uploads using the uploader component.


Regarding your first query about checking if the files have already been sent, the uploader component inherently prevents duplicate file uploads by default. Therefore, there's no need to manually check whether the file has already been sent or not.


For your second query, to track when all files have finished uploading, you can utilize the "success" event to track each file's successful upload, or the "actionComplete" event to know when all files have completed uploading. However, you mentioned that both events were not triggered at your end. We have thoroughly tested these events, and they are triggering properly. To assist you better, we have attached a sample code snippet below:


<ejs-uploader id="UploadFiles" dropArea=".control-fluid" actionComplete="onComplete" success="onSuccess" asyncSettings="@asyncSettings" autoUpload="false"></ejs-uploader>


<
script>

 

    function onComplete(args){

        // The actionComplete event triggers once all files are uploaded

    }

    function onSuccess(args) {

        // The success event triggers for each file that gets uploaded successfully.

    }

 

</script>

 


Please ensure that your implementation aligns with the provided sample code. If you're still encountering issues, kindly provide us with a replication sample of your problem so that we can offer you a prompt solution.


Feel free to reach out to us if you need any further assistance.


Attachment: ASPCoreSamples_7f9732fd.zip


KZ Karol Zynda February 20, 2024 11:34 AM UTC

Hi,

Thanks fory replay. 

actionComplete is triggered when I use standard(from control) upload button. But when I upload from code, actionComplete doesn't work. 



KP Kokila Poovendran Syncfusion Team February 22, 2024 10:18 AM UTC

Hi Karol Zynda,



Thank you for bringing this to our attention.


We've thoroughly reviewed your query and prepared a sample based on your scenario. Upon testing, we couldn't replicate the issue at our end. When we uploaded files programmatically through a button click event, the action complete event was triggered properly.


To assist you further, could you provide a sample that replicates the issue you're experiencing? Alternatively, you can modify the shared sample for better understanding. Your cooperation is greatly appreciated.


For more information, you can refer to our documentation: Uploader Documentation.


Please feel free to watch the video illustration for additional insights.





Looking forward to your response.



Attachment: ASPCoreSamples_bab88bfd.zip


KZ Karol Zynda February 22, 2024 01:23 PM UTC

I cannot add video, so I zipped and atached as zip. 
As you can see, in my code onSuccess doesn't call.


Attachment: bandicam_20240222_141717655_2d2d2c81.zip

But the files are uploaded to the server correctly



KP Kokila Poovendran Syncfusion Team February 23, 2024 11:58 AM UTC

Hi Karol Zynda,

Thank you for reaching out to us and for providing the video illustration. We've reviewed the attached file, and while we attempted to replicate the issue based on your demonstration, we were unable to encounter the same issue on our end.

We've prepared a sample based on your video illustration, where we've integrated the file uploader component within a dialog component. Upon testing, the actionComplete and successEvent were triggered properly. You can access the sample below.


Video Illustration: 186822_abc44de3.zip


To assist you better, could you please provide more details about how you are implementing the uploader component within a Grid component? Specifically, we'd like to know if the uploader behaves differently when used as a standalone component compared to when integrated with the Grid. Any additional context you can provide will help us offer a more tailored solution.

Additionally, if you could modify the attached sample to replicate your specific issue or provide a sample that mirrors your implementation, it would greatly aid in our troubleshooting process.

Thank you for your cooperation. We look forward to resolving this issue promptly.




Loader.
Up arrow icon