Hi,

I was just looking at the struts-upload application... why is the file uploaded to %TOMCAT_HOME%/bin ?

What i would like to do is to save the uploaded file in a subdirectory of the root of the application (%TOMCAT_HOME%/webapps/myapp/uploaddir). The saving location is determined on a the "file category" chosen in the file upload form.

Another thing I don't know is, how I can retrieve the base path of my web application.

I tried something like this:
String savingLocation = new String(                                                    
                                 request.getContextPath()
                                + "/data/"
                                + category.getPath() + "/"
                                + fileName);
Then I create a File with this path as in:
File tempFile = new File(savePath);

If i read the absolute path of the tempFile:
String absPath = tempFile.getAbsolutePath();

i get the following:
C:\myapp\data\tests\uploadedFile.txt
where
- myapp is the name of the application
- tests is the path name for this category supplied in the form
- uploadedFile.txt is the uploaded file :-)

Any tips, suggestions and examples would be highly appreciated.

Thanks, Patrick


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to