|Subject:||Re: INDY 10 And FTPServer. Put Into DataBase|
|Posted by:||Remy Lebeau (Indy Team) (email@example.com)|
|Date:||Wed, 26 Jul 2006|
"Pedro" <pizquierdo20…@hotmail.com> wrote in message
> When some client sends a file to the FTP SERVER I want to insert it
> into a database before giving the confirmation of transmitted file to
> Of that form, if insert in the database fails, I notify the client that
> PUT has failed.
> How I can do this?
TIdFTPServer does not currently support what you are asking for. There are
no events triggered when a transfer has been completed. The only possible
way to do it, without re-writing Indy's source code, is to write your own
TStream class that you then return an instance of from the OnStoreFile
event. Do your database insertion in the TStream's destructor. The
downfall to this approach, however, is that there is no way to know if the
transfer was successful or not when the TStream is freed. As for sending an
error back to the client, you would have to throw an exception (which in
itself is dangerous to do from a destructor) which TIdFTPServer would then
catch and assign an error reply to the operation. You will not be able to
send back a custom error message, though.
INDY 10 And FTPServer. Put Into DataBase posted by Pedro on Wed, 26 Jul 2006