Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write a file in a web enviroment ?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Author and ninkuma
Marshal
Posts: 66729
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!