jQuery in Action, 3rd edition
The moose likes Struts and the fly likes uploading multi images by using file upload... 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 "uploading multi images by using file upload..." Watch "uploading multi images by using file upload..." New topic

uploading multi images by using file upload...

anilkumar Gannavarapu

Joined: Oct 22, 2007
Posts: 3
I am tring to upload multiple images by using struts.

Form bean:
public class XMLActionForm extends ActionForm
private FormFile myXMLFile;
private String imagedesc;
private String cost ;
private String size;
private String imageName;
private String available;

public String getImagedesc() {
return imagedesc;

public void setImagedesc(String imagedesc) {
this.imagedesc = imagedesc;

public String getSize() {
return size;

public void setSize(String size) {
this.size = size;

public void setMyXMLFile(FormFile myFile)
this.myXMLFile = myFile;

public FormFile getMyXMLFile()
return myXMLFile;

public String getImageName() {
return imageName;

public void setImageName(String imageName) {
this.imageName = imageName;

public String getAvailable() {
return available;

public void setAvailable(String available) {
this.available = available;

public String getCost() {
return cost;

public void setCost(String cost) {
this.cost = cost;


FormFile xmlFile = xmlForm.getMyXMLFile();
FileOutputStream fileOut = null;

String contentType = xmlFile.getContentType();
String fileName = xmlFile.getFileName();
int fileSize = xmlFile.getFileSize();
byte[] fileData = xmlFile.getFileData();
String file = new String(fileData);

by using above code i am able to upload one file. But i not able to upload multiple images and along with image description. Please give some idea what are the changes i have to do in those files and is there any chance to call my action multiple times by using ajax.

my jsp code is:

<html:form action="/handleFileUpload" enctype="multipart/form-data">
<td>Painting:</td><td><html:file property="myXMLFile"/> </td>

<tr class="textbold">
<td>Description :</td>
<td valign="top" nowrap class="textnormal">
<div align="left"><html:textarea property="imagedesc"
rows="5" value="" cols="30" /></div>
<tr class="textbold">
<td>Cost :</td>
<td valign="top" class="textnormal">
<html:text property="cost"></html:text>
<tr class="textbold">
<td>Size :</td>
<td valign="top" class="textnormal">
<html:text property="size"></html:text>

<tr class="textnormal">
<td>Available for Sale :</td>
<table width="30%" border="0" cellpadding="0" cellspacing="0">
<tr class="textnormal">
<td width="11%"><html:radio property="available" value="0"/></td>
<td width="21%">yes</td>
<td width="11%"><html:radio property="available" value="1"/></td>
<td width="77%" nowrap>no</td>
<tr><td><html:submit value="Submit"/> </td></tr>

awiting for your reply....

srinivasss pappoooo

Joined: Nov 22, 2007
Posts: 2
Hi ra mama,

How are you?? n where are you??

nice to meet you after a long time. call me @ 91-9884609939 immediately.

Be selfish and help your family members but think this whole world as your family.
I agree. Here's the link: http://aspose.com/file-tools
subject: uploading multi images by using file upload...
It's not a secret anymore!