
August 2nd, 2004, 09:36 AM
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 6
Time spent in forums: 15 m 30 sec
Reputation Power: 0
|
|
|
Getting Real Path
Hi..Am developing a website using jsp in tomcat. There is a page through which I can upload images to the server. Its working in my local server. I am using the following code to get the real path of the folder where I want to upload the image:
<%@ page language="java" import="java.io.*" %>
<%
String savepath="";
ServletContext sc = getServletConfig().getServletContext();
savepath = sc.getRealPath("/") + "uploads";
out.println(savepath);
%>
I am getting the path as "C:\Program Files\TSW\Tomcat5\webapps\mysite\uploads" where 'uploads' is teh folder where I am saving the images. Its working fine. But when I am using the site in my internet server, I am getting the path as "/home/somename/public_html/mysite/uploads". Is there anyway I can get the physical path to this folder? Pls help. Its very urgent. Thanks in advance.
|