struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Koni Roth <konir...@bluewin.ch>
Subject Re: uploading file
Date Fri, 26 Sep 2003 14:23:06 GMT
Hi Kannan
Just donne this on a Windows machine ;-) Here a hint for your Action...

<snip>
...
FormFile file = (FormFile)dynaForm.get("theFile");
String fileName = file.getFileName();
String filePath = "E:/apps/webapp/MyApplication/WEB-INF/uploads/";
File newPath = new File(filePath);
newPath.mkdirs();
...
OutputStream bos = new FileOutputStream(filePath + fileName);
...
</snip>

See also:
http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/fileupload/package-summary.html#package_description

Hope it helps
Koni


Kannan wrote:
> Hi All!
> I'm using  struts 1.1 , i'm creating a application based on struts 
> commons-upload ,I'm following
> the struts upload example...
> I would like to upload a file into a perticular directory..
> 
> /webapp
>          /MyApplication
>                 /WEB-INF
>                  /uploads            /**  Here the files i upload should 
> go.. */
> 
> can u help me to set this path...in  Action  Class..( or any other 
> suggestions)
> Thanks in advance,
> Kannan.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 

-- 
  Jump and the earth will rise to meet you!
  http://www.rothweb.ch
  http://www.rothconsulting.com


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


Mime
View raw message