*
The moose likes Websphere and the fly likes Getting realpath in webspehere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Getting realpath in webspehere" Watch "Getting realpath in webspehere" New topic
Author

Getting realpath in webspehere

Chetan Sharma
Greenhorn

Joined: Nov 20, 2008
Posts: 7
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting realpath in webspehere
 
Similar Threads
issue with getting real path in servlet using eclipse
Error message on running the java code from Eclipse
Runtime.getRuntime().exec
Changing FilePath from full filepath to project folder filepath
zehon FTP Files Transfered successfully but folder relative to home