Hey Guys,
I'm looking at using a Ftplet to intercept file uploads and write them
to another location. I have tried overriding public FtpletEnum
onUploadStart(FtpSession ftpSession, FtpRequest ftpRequest) throws
FtpException, IOException with:
public FtpletEnum onUploadStart(FtpSession ftpSession, FtpRequest
ftpRequest) throws FtpException, IOException {
File temp = File.createTempFile("upload", "ftp");
OutputStream stream = new
FileOutputStream(File.createTempFile("upload", "ftp"));
try {
//tell the client 150 so he sends the file
DataConnection dataConnection =
ftpSession.getDataConnection().openConnection();
dataConnection.transferFromClient(stream);
stream.flush();
stream.close();
ftpSession.getDataConnection().closeDataConnection();
}
catch(Exception e) {
logger.error("Could not upload file", e);
}
return FtpletEnum.RET_SKIP;
}
The file does not transfer. This is probably because I never sent a
"150: File status okay; about to open data connection." To the client.
I can not seem to figure out how to send that. The FAQ on the site
explains how to send files from the database but the signature of the
interface differs from what I see in SVN.
Any thoughts/Comments on how I can do this would be appreciated!
Thanks,
Brooks Lyrette