Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File upload in struts

 
Achal Jalan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

 
Ganesh Gowtham
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic