aspose file tools*
The moose likes Servlets and the fly likes How to write a file in a web enviroment ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to write a file in a web enviroment ?" Watch "How to write a file in a web enviroment ?" New topic
Author

How to write a file in a web enviroment ?

Marcio Di Pietro
Greenhorn

Joined: May 30, 2003
Posts: 2
Friends, i'm using the example of upload that comes with the struts.
The example works fine, but when a choose a path to save the uploaded file, i must to pass a concrete path, like "c:/.../img/teste.jpg"
But the application is in the web, hosted in a server in any place.
How can i define the target path to the file be saved in a web enviroment ?


Hey, who are you ?<br />Give me some code.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Check out the ServletContext.getRealPath() method if you want to save the file within the app context, or specify the base path as an init parameter or property.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to write a file in a web enviroment ?