How can I know when a client loaded FTP file is complete?

  • Thread starter Thread starter Josh
  • Start date Start date
J

Josh

I have a vb.net app that is using FileSystemWatcher to fire an event
when a file is uploaded by the client via FTP. The app needs to wait
until the upload is complete then perform actions on the uploaded file.
When I use file.exists, it returns true even before the file is
complete.
The file attribute (size) = (the completed file size); and attribute
(normal) = (normal) even before the file upload is complete.
I would greatly appreciate any suggestions for this.
 
josh,

my initial thought would be to try and rename the file, then read the file.
If the file upload is still in progress, you will get an exception on the
rename. Then sleep and try again later. I don't know of a fancier, api way
to tell if the file is busy.

jeff
 
Back
Top