aspose file tools*
The moose likes Struts and the fly likes can I upload a file in a war? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "can I upload a file in a war?" Watch "can I upload a file in a war?" New topic
Author

can I upload a file in a war?

Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
Hi there, I'm using struts and JBoss to upload and save files on the disk.
The application comes our as ear -> war
If I'm not wrong the ear file is actually extract and deployed in a temporary folder, right?
So, what would be the best way to specify the location where to save the file, I mean inside my webapp.

Thanks in advance
[ May 27, 2007: Message edited by: Alessandro Ilardo ]

trying to decode a woman mind....
Pravin Jain
Ranch Hand

Joined: May 20, 2007
Posts: 60
In a servlet or jsp you can use the getRealPath method convert
a path relative to your application root into the OS specific
path, this can help you to create a java.io.FileOutputStream
or java.io.FileWriter as per your requirement, which could be
the destination of your uploaded files within your webapp.


The Zen of Java Programming.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can I upload a file in a war?