Re: FTP Store file

Giganews Newsgroups
Subject: Re: FTP Store file
Posted by:  Don (kingfi…@joesgarage.org)
Date: Mon, 28 Nov 2005

> Using Indy 10
> In my FTP server I would like to know when a file upload is completed on
> disk. So far as I can see the OnStoreFile event is generated before the
> file is transferred and a new FileStream is created and passed to Indy to
> use to store the file. I'm really looking for an OnStoreFileDone event or
> something like that.

The STOR command is handled using the CommandHandlers for the server. There
is an OnAfterCommandHandler event in the CommandHandlers for the Server that
can be used to receive notification that a client context has finished
checking for a valid command handler for the latest command.

Unfortunately, it cannot access the DataChannel at that point... it has
already been destroyed after the write operation and the response has
already been sent.

Sounds like something that could (or should) be added to the CommandHandlers
mechanism directly.

> Also I'm not sure how the stream passed to Indy is destroyed after use.

The stream gets passed in DataChannel.Data allocated for the server context.
The last action taken in TIdFTPServer.DoDataChannelOperation is to free any
stream allocated to the DataChannel followed by freeing the DataChannel
itsself.

hth...

Replies

In response to

FTP Store file posted by Joe on Fri, 25 Nov 2005