This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
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
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply 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: 56529
    
  14

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to write a file in a web enviroment ?
 
Similar Threads
How to set classpath on XP?
chapter 3 "mini MVC"
Adding Enviroment variable using ANT
import the Pjava enviroment
setting system envarioment variables in java