Here's what I did:
String path = session.getUser().getHomeDirectory();
FileSystemView fv = session.getFileSystemView();
FtpFile wd = fv.getWorkingDirectory();
path += wd.getAbsolutePath(); // / or /home/x/y
path += "/";
path += request.getArgument();
// Make it into a system style path removes \\
File f = new File(path);
//now prefix with the full path
path = f.getAbsolutePath();
// finally get rid of that \. to clean it up
path = path.replace("\\.\\", "\\");
CriterCamMain.newJpgImage(path);
Roger
----- Original Message -----
From: "Toli Kuznets" <[email protected]>
To: <[email protected]>
Sent: Tuesday, June 01, 2010 10:02 PM
Subject: Is there a way to get the full underlying path of an uploaded fil
in an Ftplet?
Hi,
I'm trying to write an Ftplet that performs a custom action on a file
after it gets uploaded in the onUploadEnd() method.
I can get the current workingDir and the name of the file uploaded
from the session, but it doesn't seem that I can get the real
underlying pathname to that file.
It exists in the session.getFileSystemView().rootDir variable, but
it's not expose - I can't seem to find an accessor for it. The
session.getFileSystemView().getFile(theFile) return an FtpFile, which
again doesn't expose the underlying path.
Is there a way to get to that? I don't have a user object in the
FtpLet, so i can't lookup the user's homeDir.
I can, of course, pass around my own object to the Ftplet constructor
that can do the username->homeDir lookup, but i was hoping to avoid
that.
thanks.