We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

File upload: Delete modified file.

Hi,

I'm using Blazor webassembly with .Net6 (6.0.10) and Syncfusion 20.3.0.56.

When I upload a file with the file uploader, then I modify it on my computer and finally I try to delete it. The deletion failed.

I would still like to be able to delete the file. What can I do? Is it an issue?

I attached an example project.

Best regards,

François


Attachment: Delete_Modified_File_5e3ee39c.zip

8 Replies 1 reply marked as answer

UD UdhayaKumar Duraisamy Syncfusion Team November 14, 2022 10:03 AM UTC

We attempted to reproduce the reported issue. Unfortunately, we were unable to replicate the stated problem. A video illustration has been supplied for the same. The file deletion will be done using the uploaded file name. If you modify the uploaded file content( except file name), it will be deleted as per your scenario. If the file name is changed, you will not be able to delete the file.


Video illustration : https://www.syncfusion.com/downloads/support/common/3254/ze/67_5eb591ae.zip




FR François November 15, 2022 10:38 AM UTC

Hi UdhayaKumar,

Thank you for your reply.

I can't access the video you shared. I get an "access denied" message. Can you please grant me access?

I observe this problem with Chrome (v 107.0.5304.107) and Edge but not with Firefox. I didn't have this problem a few weeks ago.

I'm attaching my own video of how I replicate the problem.

Best regards,

François


Attachment: Delete_modified_file_video_90558d09.zip


FR François November 15, 2022 10:46 AM UTC

In the browser console I get the message: 

Failed to load resource: net::ERR_UPLOAD_FILE_CHANGED




UD UdhayaKumar Duraisamy Syncfusion Team November 21, 2022 10:13 AM UTC

In Windows applications, if you open the file and then close it, the file will be maintained in the cache. In your scenario, you are trying to upload and write a file to the same folder. So the uploaded file is maintained in the cache. You can avoid this error by uploading and writing files in different folders. Please refer to the below public blogs for more information.


  1. https://www.maketecheasier.com/solve-file-is-open-in-another-program-error-windows/

  2. https://answers.microsoft.com/en-us/windows/forum/all/file-open-in-another-program/71fac0f4-4f8d-4319-9293-d5f109761cc5



FR François December 5, 2022 03:11 PM UTC

Hi UdhayaKumar and thanks for your answer.

Sorry for my late reply.

The answer you give me implies that the file is cached by Windows. Did I understand it correctly?

I don’t think it is a problem with Windows because I don’t get the “file is open in another program” error and because it works with Firefox. I think it may be a security feature from chromium. What do you think?


When this error happens, instead of blocking the deletion, could the SfUploader send the name of the file to delete to the controller ? Like the case where the file is preloaded (see https://www.syncfusion.com/forums/178876/file-upload-remove-a-preloaded-file).


Best regards,

François



UD UdhayaKumar Duraisamy Syncfusion Team December 6, 2022 06:57 AM UTC

You can also delete the uploaded file by using the file name by setting PostRawFile to false in the uploader component's BeforeRemove event arguments. In the online demo, too, uploaded files are deleted using the file name only. Please refer to the shared site for more information.


https://blazor.syncfusion.com/demos/file-upload/default-functionalities?theme=fluent


Marked as answer

FR François December 8, 2022 03:26 PM UTC

Thanks UdhayaKumar,

You are right, setting PostRawFile to false avoid this error. I had the answer right before my eyes ^^.

Just for information, a discussion where a member of Chromium explains the behavior observed: https://bugs.chromium.org/p/chromium/issues/detail?id=1086707#c7



SS Shereen Shajahan Syncfusion Team December 9, 2022 06:21 AM UTC

François, we are marking this forum as solved. Please let us know if you need further assistance.


Loader.
Live Chat Icon For mobile
Up arrow icon