Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 2nd, 2004, 09:36 AM
sal_jo sal_jo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 sal_jo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #2  
Old August 2nd, 2004, 10:15 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Is that not the physical path?
Your web server appears to be Unix

What path are you expecting it to go in?

Reply With Quote
  #3  
Old August 3rd, 2004, 02:10 AM
sal_jo sal_jo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 sal_jo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 30 sec
Reputation Power: 0
Thanks for the reply. I am not familiar with Unix. It is a unix server but I do not run it. Thanks again.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Getting Real Path


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT