I have something sort of similar in my code. I only allow uploads to a
specific directory which for me is a well-defined name. Hope this helps:



------------------------- cut ---------------------------
public FtpletResult beforeCommand(FtpSession session, FtpRequest request)
                  throws FtpException, IOException {

            String cmd = request.getCommand().toUpperCase();
            User user = session.getUser();

            if (cmd.equals("STOR") || cmd.equals("STOU") || cmd.equals(
"APPE")) {
                  if (! isUploadDirectory(user,request.getArgument()) {
                        LOG.debug("Attempt to upload files to non-shared
upload area. Command will be aborted.");
                        writeMessage(session,FtpReply.
REPLY_550_REQUESTED_ACTION_NOT_TAKEN,"Read-only; " + cmd + " not permitted
by administrator.");
                        return FtpletResult.SKIP;
                  }
            }
}
------------------------cut ---------------------------------

Best Regards,

Gary

Reply via email to