This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File upload in struts" Watch "File upload in struts" New topic

File upload in struts

Achal Jalan

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
[ March 29, 2005: Message edited by: Achal Jalan ]
Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75

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 :

Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

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
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).


Hope that helps you.
I agree. Here's the link:
subject: File upload in struts
It's not a secret anymore!