File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes File upload in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File upload in struts" Watch "File upload in struts" New topic
Author

File upload in struts

Achal Jalan
Greenhorn

Joined: Nov 23, 2004
Posts: 21
Hi Guys,

I am trying to upload a file in struts,

In my action form I have


In the action class



At this point I am stuck, I need to store the file on the hard disk.
Can some one give me a few hints or a code snippet.

Thanks in advance for all the help
Achal
[ March 29, 2005: Message edited by: Achal Jalan ]
Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75
Hi

Since you know how to get the byte array contening the raw data, the usual way to write a file should apply.

Let's suppose you're working in the root directory of C:\ and you want to create a file called "uploadedData.dat" from the array you called fileData :



Franck<p>--------------------
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

hi
rather than struggling with all these try 2 download jar and tld web page[blue]make ur self free from burden ok.[/blue] make use of all uri i mean tag lib's they will give full demostartion with war file .
if still struggling let me know grgowtham_cse@YAHOO.COM


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264

Location is the FormFile and fmf.getDir() is the directory I want to put it in (from the the action form).

-Tad

Hope that helps you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File upload in struts