HI Malla,
           Some Servers dont allow to get Real Path because they is some
virtual path concept & so it is always changing & so u have to hard code the
real path. If u dont want to then I will suggest u one trick.
Try putting the desired path in a properties file which your servlet can
pick up say on init. Now suppose even if the path changes (say because u
change ur Service Provider) You dont have to change ur Servlet!!.

Bye,
Jiger


>From: Malla c <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Physical path of a file from its virtual path relative to the web
>             site root.
>Date: Mon, 26 Feb 2001 21:43:54 -0000
>
>Hi
>
>I am working on upload problem.. I am using jspsmart api to upload any type
>of files from the browser and I am storing into oracle database.
>
>Here I am getting file from browser and I am saving in web server virtual
>path "/demo/upload"
>
>after that I am taking this file and I am storing into database. It's
>working fine. The problem is I am taking physical path like
>"/opt/JRun/servers/default/myapp/demo/upload/" I am opening this file and I
>am reading this file and I am storing into oracle Blob data type.
>
>The problem is here I am hard coding this physical path in my program. I am
>using ServletContext.getRealPath("") to get physical path but it is not
>getting physical path but I am getting web server root directory.
>
>Please any help me this problem, I will thankful to u.
>
>Please reply to this mail asap.
>
>
>Thanks,
>Malla Reddy
>[EMAIL PROTECTED]
>
>count = mySmartUpload.save("/demo/upload");
>
>String filename = mySmartUpload.getFiles().getFile(0).getFileName();
>
>
>String realpath= "/opt/JRun/servers/default/myapp/demo/upload/";
>
>fullpath = realpath + filename;
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to