Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting realpath in webspehere

 
Chetan Sharma
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I am uploading a file using filepath getServlet().getServletContext().getRealPath("/"). Using this I am getting filepath as
F:\PAF\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\paf_v1EAR.ear\paf_v1.war

where F:\PAF is my workspace. This is a temporary folder which gets deleted after sometime. Can you tell me how can I upload files in a folder say upload inside PAF workspace i.e. F:\PAF\upload ??
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't like the directory which those methods give you, who is forcing you to use it? Go ahead and upload to F:\PAF\upload if you like.

Also, you're running this inside Eclipse. I assume this is a web application which is going to be deployed on an actual web application server at some point. You're going to have the same problem there: every time you redeploy your application, anything you uploaded to a folder in the application will disappear. So you should consider uploading to some other directory outside the web application anyway.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic