You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Deepak <de...@ltp.soft.net> on 2004/03/24 08:03:36 UTC

File upload location

Hi,
    What is the default location of a file uploaded using <html:file> ? Can I upload it to one of the folders in my context path ?

thanks
Deepak

Re: File upload location

Posted by Mark Shifman <ma...@yale.edu>.
Deepak wrote:

>Hi,
>    What is the default location of a file uploaded using <html:file> ? Can I upload it to one of the folders in my context path ?
>  
>
It goes someplace temporary. If you look at the src for the UploadAction 
example in Struts, it shows how to save the temporary file.

I create a temporary dir with sessionCreated() in the 
HttpSessionListener ie "myapp/temp/sessionID"

then you can get to it via 
session.getServletContext().getRealPath("temp") + "/"+ session.getId();

and create an outputstream that goes there.

When the session is destroyed I remove the files and the dir 
"myapp/temp/sessionID"

>thanks
>Deepak
>
>  
>


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shifman@yale.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org