Hi,
Both this and the original poster's intent are pretty bad as far as
portability goes.

First, instead of re-inventing the wheel, use a good and proven componet
for upload handling, like commons-fileupload
(http://jakarta.apache.org/commons/fileupload/using.html).

Second, know that the Servlet Specification guarantees only one place
where you can write files: the directory accessible via
(File)
getServletContext().getAttribute("javax.servlet.context.tempdir").

If you want another directory, set it as an init-parameter to your
upload servlet or your servlet context, or maybe even a JNDI Environment
reference.  Don't rely on the concept of "current working directory" as
that's wildly different from one server implementation to another, and
it's highly insecure.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Arun Prasad R [mailto:[EMAIL PROTECTED]
>Sent: Friday, September 10, 2004 8:00 AM
>To: Tomcat Users List
>Subject: Re: Help - Newbie questions - where are the uploaded files
stored
>?
>
>hi
>
>you can set a session property like
>System.setProperty("user.dir", "/your/application/home");
>this will change the applications current working dir.
>
>i have not checked the side effects. whether tomcat will be affected
>by this action or not
>arun
>
>On Fri, 10 Sep 2004 12:00:45 +0200, MATHOT Jacques
><[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> I am implementing an upload function for my web applications using
Tomcat
>4.0.14 server. I was expecting the files to be stored on the root
directory
>of my application and not in one of the own Tomcat directories.
>> How can I specify that the directory to be used is my application
root
>directory ?
>> Thanks in advance.
>> Regards,
>> Jacques Mathot
>>
>>         FileInputStream fis = new FIleInputStream("Doc8585.zip");
>>         ...
>>
>> ____
>>
>> This message and any files transmitted with it are legally privileged
and
>intended for the sole use of the individual(s) or entity to whom they
are
>addressed. If you are not the intended recipient, please notify the
sender
>by reply and delete the message and any attachments from your system.
Any
>unauthorised use or disclosure of the content of this message is
strictly
>prohibited and may be unlawful.
>>
>> Nothing in this e-mail message amounts to a contractual or legal
>commitment on the part of EUROCONTROL unless it is confirmed by
>appropriately signed hard copy.
>>
>> Any views expressed in this message are those of the sender.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to