My client has configured a SFTP server and monitoring the folder using FileWatcher. As soon s as the file are copied to SFTP server, client picks them.
If the connection is broke down while transferring the file, client picks the invalid file.
In between, I go for deleting the invalid file, client has already picked and delete that file from that folder.
How I can stop access for client to that file until I finish the full transaction.
preguntado el 03 de mayo de 12 a las 08:05
Romil Kumar Jain
There exist two generic options - upload the file to different folder and move it (you have denied this for your particular case) and upload the file with different name and rename the file once upload is complete.
If you control the server's architecture, you can do the following trick: upload the file with the name of filename..ext . The server will check the file name and know expected size. Once the file is of specified size, it can be picked and renamed by the server.
You should use a temporary folder for upload, and move the files in the monitored folder only when the file is completely upload.