Search code examples
delphiindyftp-server

AfterPutFile event with Indy FTP Server


I'm writing a FTP Server application which uses Indy FtpServer component, Version 10.5.9.0.

I need to intercept the "AfterPutFile" event because I have to do an action after, however I didn't find any event that does this.

Can someone help me? Thanks. Enzo


Solution

  • TIdFTPServer does not currently provide an event for that situation. A related enhancement was discussed on Indy's web forum a couple of months ago, but it has not been implemented yet. It is in Indy's issue tracker:

    Issue #65147: Add events to TIdFTPServer when transfers are complete

    Currently, the only way to detect the end of an upload transfer is to derive a custom class from TStream and override its destructor, and then assign an OnStoreFile event handler that creates an instance of that class to receive the client's file data. When the transfer is finished, the stream is destroyed. The downside to this approach is that there is no way to know whether the transfer was successful or failed, since the stream is destroyed either way.