2009/5/12 massimiliano basilica <[email protected]>:
> HI all,
> I'm using FTPServer 1.0.I need that the FTPServer stores a file with a 
> temporary file extention and  rename it with originally file name.The 
> scenario is:The Client sends the file "FirstFile.txt" (put FirstFile.txt).The 
> FTPServer must store it as FirstFile.txt.tmp. When the uploading is 
> completed, the FTPServer must rename it as FirstFile.txt.All must 
> be transparent to the Client, it can't use the command

Hello massimiliano,

I have implemented something like that and it's kinda working but see
several potential problems:

 - There's no way to know (at the server side) if the file has been
transferred correctly. When the data connection is closed, the server
thinks the file transfer finished correctly but this must not be the
case. Thus, the file could be renamed to it's final name even though
the connection was aborted -> you end up with an uncomplete file.

 - Currently the onUploadEnd ftplet method will be executed after the
response to the client is sent. So if the file-rename fails the client
wouldn't know that anything happened. If this is a problem for you
(most likely) you should use your own STOR method. Otherwise, you can
use onUploadStart() ftpLet method for the first rename and onUploadEnd
for the final one.

Since we had this implemented before the change in ftpets what I did
is to provide my own STOR method which is an exact copy of Ftpserver's
implementation but adding a call to  the "rename-to-.txt" method  in
the Ftplet before the response is written to the session.




>
>
>
>
>
>
>

Reply via email to