I'v figured out a implementation by copy the sourcecode in STOR.java to my
Ftplet's onUpload method.
The following the sourcecode ,pls notice the // at the start of some lines ,
Some changes are needed:
1, LocalizedFtpReply.translate()method is not usable in ftplet,
2, create a new
Hi,
In my web service I want the user to only be able to upload files to an
upload directory, which is created on the fly in response to an upload
request from the client.
On receiving the upload request the web service makes a new directory
called upload, and sends the URI back to the client.
Hello Matt,
You can use a custom FTPLet for this. If you search the mailing list
you will find this question asked several times ...
For FTPES only:
In your custom FTPLet you can hook onLoginStart - this is the
beforeCommand when the command is USER- to make sure that channel is
secured with
Hi David,
Yes, I think I would use FTPServer, as this would fit into my java web
service.
The file system would look like this:
/projects/ProjName/MediaName/upload
There would be many projName and MediaName directories. The upload dir
would be a temp dir, created by the web service, created
I think your code is OK except for a problem:
- Restarting a failed transfer would mean that the user can safely
ignore your limit. To solve this, you could take into account the
skipLen value in order to prevent users from circumventing your
limits.
The pieces of code you didn't
I'm sure there are other solutions but this one works for us :
You should create a custom FTPLet that intercepts the calls to
STOR, STOU, APPE (the commands that signal a file upload) before
they are issued. This is done implementing the beforeCommand() method
of the FTPLet interface.
In this
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)