Hi,

I am developing a Java Servlet that gives the user the ability to browse their machine for a specific file and submits its location


Java Code:
public void doGet (HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException
{

PrintWriter out = res.getWriter();

........

out.println("<br/><br/><input type="file" value="Browse" name="urlbar\">");

out.println("<br/><br/><input type=\"submit\" value=\"Register Document\" name=\"submit\"></font>");

....
}

At the moment the problem is that once the "submit" button has been pressed, only the file name is returned and not its entire path.

Java Code:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{

PrintWriter out = res.getWriter();

String url = req.getParameter("urlbar");
System.out.println(url);

....
}
I have tried using the getAbsolutePath() method of the File class but it returns that the file is located in the bin folder of the servlet container (which is not the case!). Can anyone help?

(if you need more info, let me know)

Thanks.