I'm trying to write an uplaod feature for my web-app.
I've managed to get the upload part working and am now trying to tidy up the management side of things, i.e. storing the uploaded file to the right location.
Basiacally I have a browse page which allows navigation through a folder/file structure, I present a link on accessable folders to the user to do the upload which navigates them (using a forward action) to the upload page where they choose the file and click 'upload' (MyUploadAction with a form-bean property org.apache.struts.upload.FormFile).
What I want to be able to do is pass the path from the browse page through the upload page to the upload action so it an work out which folder to store the file.
I can imagine two ways of doing this, although they might not be possible, or considered good solutions:
1) Packing.unpacking value into request/response:
The Browse page could somhow set a new request parameter for the path. although I wouldn't have thought the ForwardAction would preserve this value and pass it back out to the upload page? if it did/could do then we may be able to pack it into the form when the upload page is submitted.
2) A second action:
An Action class could be provided which handles storing the path when the user clicks on upload from the browse page. This would (somhow - session bean) store the path which the MyUploadAction could pick up on when the upload is submitted.
- This approach feels more defined, but would result in more Actions to maintain.
Any guidance on which, if any of these approaches is the recomended route would be appreciate, or any other solution.