Thanks Niklas,

I somehow had overlooked using session.write(). I have it working and and here is the example for the site (Using todays M3 release):

public FtpletResult onUploadStart(FtpSession ftpSession, FtpRequest ftpRequest) throws FtpException, IOException {
        File temp = File.createTempFile("upload", "ftp");
        OutputStream stream = new FileOutputStream(temp);
        try {
ftpSession.write(new DefaultFtpReply(150, "File status okay; about to open data connection.")); DataConnection dataConnection = ftpSession.getDataConnection().openConnection();
            dataConnection.transferFromClient(stream);
            stream.flush();
            stream.close();
            ftpSession.getDataConnection().closeDataConnection();
ftpSession.write(new DefaultFtpReply(226, "Closing data connection. Requested file action successful"));
        }
        catch(Exception e) {
            logger.error("Could not upload file", e);
        }
        return FtpletResult.SKIP;
    }

Cheers,

Brooks
On 9-Sep-08, at 11:28 AM, Niklas Gustavsson wrote:

On Tue, Sep 9, 2008 at 4:59 PM, Brooks Lyrette <[EMAIL PROTECTED] > wrote:
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.

We should really do an example of this on the web site...

Besides that, and without Eclipse available at the moment to test this
code, you should be able to do:
session.write(new DefaultFtpReply(150, "File status okay; about to
open data connection."));

/niklas

Reply via email to