Unable to cancel and keep old file with single file uploader

Good afternoon,


I am currently using the asynchronous uploader component with property 'multiple' set to false, such that I can only upload one file at a time in this component.


A business requirement is that when a new file is selected (either through 'Browse' or by dragging the document into the draggable area) and the uploader already holds an uploaded file, the user should receive a confirmation dialog. If they choose 'keep original file', the original file should be kept and the new file should not be uploaded.

I can cancel the new upload through overriding the 'fileSelected' event. However, I do not seem to be able to keep the original file, as it is always deleted from the filelist no matter which option is picked in the dialog. The 'removing' event is never triggered so I can not use this event to prevent this.


Is there any way to implement this requirement?


Thanks for your time.


4 Replies

BC Berly Christopher Syncfusion Team August 9, 2021 01:52 PM UTC

Hi Alma, 
  
Currently, we are working on the reported issue. So, we will validate and update the further details in two business days (11th August 2021).  
  
Regards, 
Berly B.C 



BC Berly Christopher Syncfusion Team August 11, 2021 03:11 PM UTC

Hi Alma
 
Thanks for the patience. 
  
We have prepared the sample for rendering the Uploader component and allows the file using the confirmation dialog. When we are using the multiple property as false, once file is selected from the file explorer then previously uploaded or selected file details will be cleared from the component. This is the intended behavior of this property.  
  
  
  
Regards,  
Berly B.C 



AL Alma August 12, 2021 08:10 AM UTC

Hello Berly,


Thank you for your answer. Unfortunately the answer does not solve our issue. 


I was already able to show a confirmation dialog, but the issue was that the old file is already deleted when I trigger the 'onFileSelected' event of the new file.


I think the answer to this problem lies in making sure that the removal of the old file is triggered in such a way that the 'removing' event is fired correctly, just like when a user manually removes a file. Once this is done, I can correctly override this event and make sure the event is cancelled when appropriate.


Can you please elaborate on whether it is possible to implement this solution?


Thanks for your time.


Regards,

Alma



BC Berly Christopher Syncfusion Team August 13, 2021 01:46 PM UTC

Hi Alma, 
  
As we mentioned earlier, if we are using multiple property in the Uploader component and selecting another file from the explorer, then previously selected file information will be cleared from the component. So that li item of the corresponding file will be removed from the DOM. At this time there is no event will be triggered. This is the intended behavior of the component.  
  
Regards, 
Berly B.C 


Loader.
Up arrow icon