Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using FileSystemWatcher to watch FTP location. When new file is arrived, created event is fired,and when file is uploaded, change event is fired. Now, problem is when file is uploaded from any client application, then an user may pause-resume or abort uploading, then also Change event is triggered. Also, when uploading file is paused for few seconds and resumed, again Changed event is triggered on successfully upload.

In this scenario, how I can identify, whether file is completely uploaded, after many pause/resume or cancellation?
Posted

1 solution

FileSystemWatcher is not trust worthy.


Instead of FileSystemWatcher you can go with timer.
Set a timer and look inside the folder after particular interval, when you see a new file do the operation.

Situations when FileSystemWatcher will fail:
1. When you are using Network drives for storage.
2. Sometimes it will eat out the notification and will not notify.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900