Re: How to Monitor the uploading a file using java



Gordon Beaton wrote:
If you can, have the uploading process upload to a different name (an
additional suffix will do) or different directory. It can then rename
the finished file to the final destination (an atomic operation) where
your application detects it and can safely assume that it is complete.

/gordon


That's exactly right.

If the client doesn't have the ability to rename the file, then upload another empty file with a different extension as an indicator that the upload task is now complete. This will be the file you want to monitor (filter your monitor on this 2nd extension).

If none of the above options are feasible, then you would have no option but to monitor the size of the file, and determine an acceptable span of time where if the size doesn't change (within that time period), then a file uploaded event is triggered. (this is *very* ugly, but works if you trust your system/network environment, specially if the constant size time span is large, which would slow down your server's response).

.



Relevant Pages

  • Re: how to lock a file in ftp site
    ... > In FTP a rename is usually an atomic action but an upload is ... use directory creation instead of a rename, ... Westpac's liability is limited to resupplying any affected attachments. ...
    (comp.lang.python)
  • Re: Photo resize and upload
    ... Irfanview will batch rename and optimise images before you upload them. ... All you have to do is select the images, optimise and rename in Irfanview, then import the optimised images into your website for publishing. ...
    (microsoft.public.frontpage.client)
  • Re: [PHP] Rename generates level 2 warning but works
    ... >> of time yesterday with an upload script that did not recognize files when ... Still getting the warning AND the rename function works. ...
    (php.general)
  • Help with rename and unlink script please
    ... I am trying to upload a file and then rename the file as something else. ... Everything worked fine unless the renamed filename already existed. ... echo "There was an error in your file upload. ...
    (comp.lang.php)
  • FileSystemWatcher Folder Rename
    ... We are using FileSystemWatcher class in a windows service to monitor a ... This path is configured in a config file. ... open up Windows Explorer and rename d:\abc to d:\xyz. ...
    (microsoft.public.dotnet.general)